fix(login): fix

This commit is contained in:
2026-03-16 15:55:33 +08:00
parent fb31c13336
commit 37ecb4641b
6 changed files with 50 additions and 31 deletions

View File

@@ -1,22 +1,22 @@
"use client"
import { useUserStore } from "@/app/store/user"
import { usePermissionStore } from "@/components/label/store/auth"
import { usePathname } from "next/navigation"
import { useEffect } from "react"
export function InfoCheck() {
const pathname = usePathname()
const user_info = useUserStore.getState().user_info
const user_id = usePermissionStore.getState().user_id
useEffect(() => {
if (pathname.startsWith("/login")) {
return
}
if (!user_info.account) {
if (!user_id) {
// tauri 打包后, 使用router.push跳转路由不执行会导致白屏
window.location.href = "/login"
}
}, [pathname, user_info.account])
}, [pathname, user_id])
return <></>
}