mirror of https://github.com/certd/certd
fix: 修复token过期后,疯狂打印token过期信息的bug
parent
7d96a57d73
commit
50a5fa15bb
|
@ -120,7 +120,7 @@ function createService() {
|
||||||
errorLog(error, error?.response?.config?.showErrorNotify);
|
errorLog(error, error?.response?.config?.showErrorNotify);
|
||||||
if (status === 401) {
|
if (status === 401) {
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
userStore.logout();
|
userStore.logout(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error?.config?.onError) {
|
if (error?.config?.onError) {
|
||||||
|
|
|
@ -108,10 +108,12 @@ export const useUserStore = defineStore({
|
||||||
/**
|
/**
|
||||||
* @description: logout
|
* @description: logout
|
||||||
*/
|
*/
|
||||||
async logout(goLogin = true) {
|
async logout(goLogin = true, from401 = false) {
|
||||||
this.resetState();
|
this.resetState();
|
||||||
resetAllStores();
|
resetAllStores();
|
||||||
await UserApi.logout(); //主要是清空cookie
|
if (!from401) {
|
||||||
|
await UserApi.logout(); //主要是清空cookie
|
||||||
|
}
|
||||||
goLogin && router.push("/login");
|
goLogin && router.push("/login");
|
||||||
mitter.emit("app.logout");
|
mitter.emit("app.logout");
|
||||||
},
|
},
|
||||||
|
|
966
pnpm-lock.yaml
966
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue