mirror of
https://github.com/Tencent/tdesign-vue-next-starter.git
synced 2024-11-10 10:58:25 +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', {
|
export const useUserStore = defineStore('user', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
token: localStorage.getItem(TOKEN_NAME) || 'main_token', // 默认token不走权限
|
token: localStorage.getItem(TOKEN_NAME) || 'main_token', // 默认token不走权限
|
||||||
userInfo: InitUserInfo,
|
userInfo: { ...InitUserInfo },
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
roles: (state) => {
|
roles: (state) => {
|
||||||
|
@ -73,7 +73,7 @@ export const useUserStore = defineStore('user', {
|
||||||
async logout() {
|
async logout() {
|
||||||
localStorage.removeItem(TOKEN_NAME);
|
localStorage.removeItem(TOKEN_NAME);
|
||||||
this.token = '';
|
this.token = '';
|
||||||
this.userInfo = InitUserInfo;
|
this.userInfo = { ...InitUserInfo };
|
||||||
},
|
},
|
||||||
async removeToken() {
|
async removeToken() {
|
||||||
this.token = '';
|
this.token = '';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user