Normalize legacy home redirects

This commit is contained in:
2026-06-09 18:45:02 +08:00
parent 39aa708c4f
commit f8bdc3e952
6 changed files with 49 additions and 33 deletions
@@ -10,8 +10,7 @@ import { $t } from '@vben/locales';
import { getPreferencesConfigApi } from '#/api/core/ui-config';
import { useAuthStore } from '#/store';
const LEGACY_HOME_PATH = '/page-render/main_home';
import { normalizeHomePath } from '#/utils/legacy-home';
defineOptions({ name: 'Login' });
@@ -61,10 +60,6 @@ const getRedirectState = () => {
return redirect ? JSON.stringify({ redirect }) : undefined;
};
function normalizeRedirectPath(path: string) {
return path === LEGACY_HOME_PATH ? '/' : path;
}
type OAuthProvider =
| 'dingtalk'
| 'feishu'
@@ -115,7 +110,7 @@ async function handleLogin(params: Record<string, any>) {
if (redirect) {
// 有 redirect 参数时,登录成功后跳转到指定页面
await authStore.authLogin(params, async () => {
const targetPath = normalizeRedirectPath(decodeURIComponent(redirect));
const targetPath = normalizeHomePath(redirect);
await router.push(targetPath);
});
} else {