Skip to content

Commit

Permalink
fix(projects): Fix the issue of abnormal tab caching after logout. fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Azir-11 committed Jun 14, 2024
1 parent ad2f247 commit 3eeace9
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 @@ -7,12 +7,14 @@ import { useRouterPush } from '@/hooks/common/router';
import { fetchGetUserInfo, fetchLogin } from '@/service/api';
import { localStg } from '@/utils/storage';
import { $t } from '@/locales';
import { useTabStore } from '@/store/modules/tab';
import { useRouteStore } from '../route';
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 3eeace9

Please sign in to comment.