修复本地开发不走统一登陆

This commit is contained in:
hero920103 committed 2026-09-29 11:10:42 +08:00
1 parent c49e8d0d3f
commit 1685b22e1e
12 files changed
+161 -139

No files matched your search

+5 -2
View File
@@ -14,6 +14,7 @@ import router from './router'
import { loadAndAddDynamicRoutes } from './router'
import { createPinia } from 'pinia'
import { useAuthStore } from './stores/auth'
import { redirectToAuthorize } from '@/utils/authClient'
// import { initTheme } from './utils/theme'
// 导入全局组件
import UmoEditor from '@/views/components/UmoEditor.vue';
@@ -53,8 +54,10 @@ if (authStore.isLoggedIn) {
// 检查是否因为 token 无效而导致路由加载失败
const token = localStorage.getItem('token');
if (!token) {
authStore.clearToken();
window.location.href = '#/login';
// 本地登录已停用:直接回认证中心重新登录(不再跳 #/login)
redirectToAuthorize().catch((err) => {
console.error('跳转统一认证失败:', err);
});
}
});
}