Route legacy home to control center
This commit is contained in:
@@ -11,6 +11,13 @@ import { useAppContextStore } from '#/store/app-context';
|
||||
|
||||
import { generateAccess } from './access';
|
||||
|
||||
function normalizeHomePath(path?: null | string) {
|
||||
if (!path || path === '/page-render/main_home') {
|
||||
return preferences.app.defaultHomePath;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用守卫配置
|
||||
* @param router
|
||||
@@ -113,8 +120,7 @@ function setupAccessGuard(router: Router) {
|
||||
if (to.path === LOGIN_PATH && accessStore.accessToken) {
|
||||
return decodeURIComponent(
|
||||
(to.query?.redirect as string) ||
|
||||
userStore.userInfo?.homePath ||
|
||||
preferences.app.defaultHomePath,
|
||||
normalizeHomePath(userStore.userInfo?.homePath),
|
||||
);
|
||||
}
|
||||
return true;
|
||||
@@ -207,7 +213,7 @@ function setupAccessGuard(router: Router) {
|
||||
// 重定向逻辑
|
||||
const redirectPath = (from.query.redirect ??
|
||||
(to.path === preferences.app.defaultHomePath
|
||||
? userInfo.homePath || preferences.app.defaultHomePath
|
||||
? normalizeHomePath(userInfo.homePath)
|
||||
: to.fullPath)) as string;
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user