fix(projects): Fix the issue of abnormal tab caching after logout. fixed #495

This commit is contained in:
青菜白玉汤 2024-06-15 00:39:53 +08:00 committed by GitHub
parent ad2f24707a
commit 3eeace94dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -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();
} }

View File

@ -290,6 +290,7 @@ export const useTabStore = defineStore(SetupStoreId.Tab, () => {
resetTabLabel, resetTabLabel,
isTabRetain, isTabRetain,
updateTabsByLocale, updateTabsByLocale,
getTabIdByRoute getTabIdByRoute,
cacheTabs
}; };
}); });