refactor(app): tighten feature boundaries
This commit is contained in:
@@ -4,8 +4,8 @@ import { useEffect } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import { MobileShell } from "@/app/_components/core";
|
||||
import { hasBusinessLoginToken } from "@/lib/auth/auth_session";
|
||||
import { useAuthDispatch, useAuthState } from "@/stores/auth/auth-context";
|
||||
import { AuthStorage } from "@/data/storage/auth/auth_storage";
|
||||
import { ROUTES } from "@/router/routes";
|
||||
import { pwaUtil, Logger } from "@/utils";
|
||||
|
||||
@@ -48,9 +48,7 @@ export function SplashScreen() {
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
void (async () => {
|
||||
// 用 getLoginToken() 拿 string | null(不是 hasLoginToken() 拿 boolean)
|
||||
const r = await AuthStorage.getInstance().getLoginToken();
|
||||
if (!cancelled && r.success && r.data) {
|
||||
if (!cancelled && (await hasBusinessLoginToken())) {
|
||||
router.replace(ROUTES.chat);
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user