fix: 修复切换普通用户登录时,左侧菜单没有同步更新的bug

This commit is contained in:
xiaojunnuo
2024-10-20 01:54:49 +08:00
parent 682cb6b71c
commit 12116a89f4
11 changed files with 53 additions and 49 deletions
@@ -15,7 +15,6 @@ import { mitter } from "/src/utils/util.mitt";
interface UserState {
userInfo: Nullable<UserInfoRes>;
token?: string;
inited: boolean;
}
const USER_INFO_KEY = "USER_INFO";
@@ -26,8 +25,7 @@ export const useUserStore = defineStore({
// user info
userInfo: null,
// token
token: undefined,
inited: false
token: undefined
}),
getters: {
getUserInfo(): UserInfoRes {
@@ -114,16 +112,6 @@ export const useUserStore = defineStore({
await this.logout(true);
}
});
},
async init() {
if (this.inited) {
return;
}
this.inited = true;
},
async reInit() {
this.inited = false;
await this.init();
}
}
});