Skip to content

Commit

Permalink
fix(projects): Fix the issue of abnormal tab caching after logout
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Jun 14, 2024
1 parent 54ae82b commit e63490e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/store/modules/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import { fetchGetUserInfo, fetchLogin } from '@/service/api';
import { localStg } from '@/utils/storage';
import { $t } from '@/locales';
import { useRouteStore } from '../route';
import { useTabStore } from '../tab';
import { clearAuthStorage, getToken } from './shared';

export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
const route = useRoute();
const routeStore = useRouteStore();
const tabStore = useTabStore();
const { toLogin, redirectFromLogin } = useRouterPush(false);
const { loading: loginLoading, startLoading, endLoading } = useLoading();

Expand Down Expand Up @@ -47,6 +49,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
await toLogin();
}

tabStore.cacheTabs();
routeStore.resetStore();
}

Expand Down
3 changes: 2 additions & 1 deletion src/store/modules/tab/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ export const useTabStore = defineStore(SetupStoreId.Tab, () => {
resetTabLabel,
isTabRetain,
updateTabsByLocale,
getTabIdByRoute
getTabIdByRoute,
cacheTabs
};
});

0 comments on commit e63490e

Please sign in to comment.