This commit is contained in:
2023-05-28 16:35:13 +08:00
parent 47b47b40a8
commit 45af378c51
2 changed files with 13 additions and 2 deletions

View File

@ -84,6 +84,17 @@ const useUserStore = defineStore("user", {
}); });
}); });
}, },
// 非正常退出系统
abnormalLogOut() {
return new Promise((resolve, reject) => {
this.token = "";
this.roles = [];
this.permissions = [];
this.userInfoRes = null;
removeToken();
resolve();
});
},
}, },
persist: [{ paths: ["tenant" /*"userInfoRes"*/], storage: localStorage }], persist: [{ paths: ["tenant" /*"userInfoRes"*/], storage: localStorage }],
}); });

View File

@ -119,7 +119,7 @@ service.interceptors.response.use(
.then(() => { .then(() => {
isRelogin.show = false; isRelogin.show = false;
useUserStore() useUserStore()
.logOut() .abnormalLogOut()
.then(() => { .then(() => {
location.href = "/index"; location.href = "/index";
}); });
@ -144,7 +144,7 @@ service.interceptors.response.use(
.then(() => { .then(() => {
isRelogin.show = false; isRelogin.show = false;
useUserStore() useUserStore()
.logOut() .abnormalLogOut()
.then(() => { .then(() => {
location.href = "/index"; location.href = "/index";
}); });