Normalize legacy home redirects
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user