jump to dashboard

This commit is contained in:
2025-07-21 22:59:53 +08:00
parent d39efbb62f
commit 3375029b1f

View File

@@ -75,9 +75,15 @@ router.beforeEach(async (
const title = to.meta.title as string
document.title = `${title} - AI`
const authStore = useAuthStore()
// 用户已登录重定向到dashboard
if (to.path === '/' && authStore.isLoggedIn) {
next({ name: 'Dashboard' })
return
}
// 检查是否需要用户认证
if (to.meta.requiresAuth) {
const authStore = useAuthStore()
if (!authStore.isLoggedIn) {
next('/')
return
@@ -92,7 +98,7 @@ router.beforeEach(async (
}
}
next('/dashboard')
next()
})
export default router