mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-17 17:26:38 +08:00
fix(projects): Fix the issue of abnormal tab caching after logout. fixed #495
This commit is contained in:
parent
ad2f24707a
commit
3eeace94dd
@ -7,12 +7,14 @@ import { useRouterPush } from '@/hooks/common/router';
|
|||||||
import { fetchGetUserInfo, fetchLogin } from '@/service/api';
|
import { fetchGetUserInfo, fetchLogin } from '@/service/api';
|
||||||
import { localStg } from '@/utils/storage';
|
import { localStg } from '@/utils/storage';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
|
import { useTabStore } from '@/store/modules/tab';
|
||||||
import { useRouteStore } from '../route';
|
import { useRouteStore } from '../route';
|
||||||
import { clearAuthStorage, getToken } from './shared';
|
import { clearAuthStorage, getToken } from './shared';
|
||||||
|
|
||||||
export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const routeStore = useRouteStore();
|
const routeStore = useRouteStore();
|
||||||
|
const tabStore = useTabStore();
|
||||||
const { toLogin, redirectFromLogin } = useRouterPush(false);
|
const { toLogin, redirectFromLogin } = useRouterPush(false);
|
||||||
const { loading: loginLoading, startLoading, endLoading } = useLoading();
|
const { loading: loginLoading, startLoading, endLoading } = useLoading();
|
||||||
|
|
||||||
@ -47,6 +49,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
|||||||
await toLogin();
|
await toLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tabStore.cacheTabs();
|
||||||
routeStore.resetStore();
|
routeStore.resetStore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,6 +290,7 @@ export const useTabStore = defineStore(SetupStoreId.Tab, () => {
|
|||||||
resetTabLabel,
|
resetTabLabel,
|
||||||
isTabRetain,
|
isTabRetain,
|
||||||
updateTabsByLocale,
|
updateTabsByLocale,
|
||||||
getTabIdByRoute
|
getTabIdByRoute,
|
||||||
|
cacheTabs
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user