Fix menu query
gitea/hedera-web/pipeline/pr-beta This commit looks good
Details
gitea/hedera-web/pipeline/pr-beta This commit looks good
Details
This commit is contained in:
parent
48f00a9400
commit
5907d53aa7
|
@ -30,7 +30,7 @@ const toggleLeftDrawer = () => {
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await appStore.loadConfig();
|
await appStore.loadConfig();
|
||||||
await appStore.getMenuLinks();
|
await appStore.getMenuLinks(userStore?.userId);
|
||||||
appStore.isHeaderMounted = true;
|
appStore.isHeaderMounted = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ const logout = async () => {
|
||||||
|
|
||||||
const logoutSupplantedUser = async () => {
|
const logoutSupplantedUser = async () => {
|
||||||
await userStore.logoutSupplantedUser();
|
await userStore.logoutSupplantedUser();
|
||||||
await appStore.getMenuLinks();
|
await appStore.getMenuLinks(userStore?.userId);
|
||||||
refreshContentKey.value++;
|
refreshContentKey.value++;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -90,7 +90,7 @@ const getConnections = async () => {
|
||||||
const supplantUser = async user => {
|
const supplantUser = async user => {
|
||||||
try {
|
try {
|
||||||
await userStore.supplantUser(user);
|
await userStore.supplantUser(user);
|
||||||
await appStore.getMenuLinks();
|
await appStore.getMenuLinks(userStore?.userId);
|
||||||
router.push({ name: 'confirmedOrders' });
|
router.push({ name: 'confirmedOrders' });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error supplanting user:', error);
|
console.error('Error supplanting user:', error);
|
||||||
|
|
|
@ -27,7 +27,7 @@ const onSearch = data => (users.value = data || []);
|
||||||
const supplantUser = async user => {
|
const supplantUser = async user => {
|
||||||
try {
|
try {
|
||||||
await userStore.supplantUser(user);
|
await userStore.supplantUser(user);
|
||||||
await appStore.getMenuLinks();
|
await appStore.getMenuLinks(userStore?.userId);
|
||||||
router.push({ name: 'confirmedOrders' });
|
router.push({ name: 'confirmedOrders' });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error supplanting user:', error);
|
console.error('Error supplanting user:', error);
|
||||||
|
|
|
@ -31,9 +31,12 @@ export const useAppStore = defineStore('hedera', {
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
async getMenuLinks() {
|
async getMenuLinks(userId) {
|
||||||
const { data: sections } = await api.get('MyMenus');
|
const { data: sections } = await api.get('/MyMenus/getSections', {
|
||||||
|
params: {
|
||||||
|
userId
|
||||||
|
}
|
||||||
|
});
|
||||||
if (!sections) return;
|
if (!sections) return;
|
||||||
|
|
||||||
const sectionMap = new Map();
|
const sectionMap = new Map();
|
||||||
|
|
|
@ -296,6 +296,8 @@ export const useUserStore = defineStore('user', () => {
|
||||||
tokenConfig.value = null;
|
tokenConfig.value = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const userId = computed(() => user.value?.id);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
[mainUser, supplantedUser],
|
[mainUser, supplantedUser],
|
||||||
() => (user.value = supplantedUser.value || mainUser.value),
|
() => (user.value = supplantedUser.value || mainUser.value),
|
||||||
|
@ -336,6 +338,7 @@ export const useUserStore = defineStore('user', () => {
|
||||||
updateUserLang,
|
updateUserLang,
|
||||||
init,
|
init,
|
||||||
$reset,
|
$reset,
|
||||||
onLogin
|
onLogin,
|
||||||
|
userId
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue