mirror of
https://gitee.com/honghuangdc/soybean-admin-element-plus.git
synced 2025-12-30 10:22:25 +00:00
fix(projects): 🐛 fix post-refresh redirect routing issue. fixed [#125]
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user