mirror of
https://github.com/Tencent/tdesign-vue-next-starter.git
synced 2024-11-10 07:28:24 +08:00
fix: 修正退出后 userStore.userInfo 存在残留的问题 (#357)
This commit is contained in:
parent
e171e280e4
commit
5759c680ac
|
@ -9,7 +9,7 @@ const InitUserInfo = {
|
|||
export const useUserStore = defineStore('user', {
|
||||
state: () => ({
|
||||
token: localStorage.getItem(TOKEN_NAME) || 'main_token', // 默认token不走权限
|
||||
userInfo: InitUserInfo,
|
||||
userInfo: { ...InitUserInfo },
|
||||
}),
|
||||
getters: {
|
||||
roles: (state) => {
|
||||
|
@ -73,7 +73,7 @@ export const useUserStore = defineStore('user', {
|
|||
async logout() {
|
||||
localStorage.removeItem(TOKEN_NAME);
|
||||
this.token = '';
|
||||
this.userInfo = InitUserInfo;
|
||||
this.userInfo = { ...InitUserInfo };
|
||||
},
|
||||
async removeToken() {
|
||||
this.token = '';
|
||||
|
|
Loading…
Reference in New Issue
Block a user