fix(projects): 🐛 fix post-refresh redirect routing issue. fixed [#125]

This commit is contained in:
一寸灰
2025-08-13 10:55:38 +08:00
committed by GitHub
parent 8c215bf778
commit df1143fd75
2 changed files with 7 additions and 4 deletions

View File

@@ -40,7 +40,12 @@ export function createRouteGuard(router: Router) {
// if it is login route when logged in, then switch to the root page
if (to.name === loginRoute && isLogin) {
next({ name: rootRoute });
const redirect = to.query?.redirect as string;
if (redirect) {
next({ path: redirect });
} else {
next({ name: rootRoute });
}
return;
}

View File

@@ -78,15 +78,13 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
const lastLoginUserId = localStg.get('lastLoginUserId');
// Clear all tabs if current user is different from previous user
if (!lastLoginUserId || lastLoginUserId !== userInfo.userId) {
if (lastLoginUserId !== userInfo.userId) {
localStg.remove('globalTabs');
tabStore.clearTabs();
localStg.remove('lastLoginUserId');
return true;
}
localStg.remove('lastLoginUserId');
return false;
}