fix: Login 页面进入时自动检测登录状态(通过轻量 cookie-check)
This commit is contained in:
@@ -13,6 +13,16 @@ export function LoginPage() {
|
||||
const { status, loading: statusLoading, refresh: refreshStatus } = useLoginStatus();
|
||||
const { token } = useAuth();
|
||||
const { toast } = useToast();
|
||||
|
||||
// Auto-check cookie on mount (lightweight, no browser opened)
|
||||
useEffect(() => {
|
||||
if (!token) return;
|
||||
void checkLoginCookie().then((res) => {
|
||||
if (res.success && res.data?.hasCookies) {
|
||||
void refreshStatus(); // Only open browser if cookies exist
|
||||
}
|
||||
}).catch(() => {});
|
||||
}, [token, refreshStatus]);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [qrData, setQrData] = useState<string | null>(null);
|
||||
|
||||
Reference in New Issue
Block a user