Files
labelmain/app/store/InfoCheck.tsx
2026-02-28 13:31:19 +08:00

23 lines
554 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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