Route legacy home to control center
This commit is contained in:
@@ -11,6 +11,8 @@ import { $t } from '@vben/locales';
|
||||
import { getPreferencesConfigApi } from '#/api/core/ui-config';
|
||||
import { useAuthStore } from '#/store';
|
||||
|
||||
const LEGACY_HOME_PATH = '/page-render/main_home';
|
||||
|
||||
defineOptions({ name: 'Login' });
|
||||
|
||||
const authStore = useAuthStore();
|
||||
@@ -59,6 +61,10 @@ const getRedirectState = () => {
|
||||
return redirect ? JSON.stringify({ redirect }) : undefined;
|
||||
};
|
||||
|
||||
function normalizeRedirectPath(path: string) {
|
||||
return path === LEGACY_HOME_PATH ? '/' : path;
|
||||
}
|
||||
|
||||
type OAuthProvider =
|
||||
| 'dingtalk'
|
||||
| 'feishu'
|
||||
@@ -109,7 +115,7 @@ async function handleLogin(params: Record<string, any>) {
|
||||
if (redirect) {
|
||||
// 有 redirect 参数时,登录成功后跳转到指定页面
|
||||
await authStore.authLogin(params, async () => {
|
||||
const targetPath = decodeURIComponent(redirect);
|
||||
const targetPath = normalizeRedirectPath(decodeURIComponent(redirect));
|
||||
await router.push(targetPath);
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user