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 () => {
|
||||
await appStore.loadConfig();
|
||||
await appStore.getMenuLinks();
|
||||
await appStore.getMenuLinks(userStore?.userId);
|
||||
appStore.isHeaderMounted = true;
|
||||
});
|
||||
|
||||
|
@ -41,7 +41,7 @@ const logout = async () => {
|
|||
|
||||
const logoutSupplantedUser = async () => {
|
||||
await userStore.logoutSupplantedUser();
|
||||
await appStore.getMenuLinks();
|
||||
await appStore.getMenuLinks(userStore?.userId);
|
||||
refreshContentKey.value++;
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -90,7 +90,7 @@ const getConnections = async () => {
|
|||
const supplantUser = async user => {
|
||||
try {
|
||||
await userStore.supplantUser(user);
|
||||
await appStore.getMenuLinks();
|
||||
await appStore.getMenuLinks(userStore?.userId);
|
||||
router.push({ name: 'confirmedOrders' });
|
||||
} catch (error) {
|
||||
console.error('Error supplanting user:', error);
|
||||
|
|
|
@ -27,7 +27,7 @@ const onSearch = data => (users.value = data || []);
|
|||
const supplantUser = async user => {
|
||||
try {
|
||||
await userStore.supplantUser(user);
|
||||
await appStore.getMenuLinks();
|
||||
await appStore.getMenuLinks(userStore?.userId);
|
||||
router.push({ name: 'confirmedOrders' });
|
||||
} catch (error) {
|
||||
console.error('Error supplanting user:', error);
|
||||
|
|
|
@ -31,9 +31,12 @@ export const useAppStore = defineStore('hedera', {
|
|||
]
|
||||
}),
|
||||
actions: {
|
||||
async getMenuLinks() {
|
||||
const { data: sections } = await api.get('MyMenus');
|
||||
|
||||
async getMenuLinks(userId) {
|
||||
const { data: sections } = await api.get('/MyMenus/getSections', {
|
||||
params: {
|
||||
userId
|
||||
}
|
||||
});
|
||||
if (!sections) return;
|
||||
|
||||
const sectionMap = new Map();
|
||||
|
|
|
@ -296,6 +296,8 @@ export const useUserStore = defineStore('user', () => {
|
|||
tokenConfig.value = null;
|
||||
};
|
||||
|
||||
const userId = computed(() => user.value?.id);
|
||||
|
||||
watch(
|
||||
[mainUser, supplantedUser],
|
||||
() => (user.value = supplantedUser.value || mainUser.value),
|
||||
|
@ -336,6 +338,7 @@ export const useUserStore = defineStore('user', () => {
|
|||
updateUserLang,
|
||||
init,
|
||||
$reset,
|
||||
onLogin
|
||||
onLogin,
|
||||
userId
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue