wr: isInit

This commit is contained in:
2026-06-08 11:02:11 +09:00
parent 66db81071e
commit 8c1a976b5b
3 changed files with 38 additions and 20 deletions
+6 -1
View File
@@ -21,6 +21,7 @@ import {
StoreProvider as WrStoreProvider,
useWrStore,
} from "@/app/store";
import { usePathname } from "next/navigation";
//import { LoginApi } from "@/src/entities/auth";
//import { useEffect } from "react";
import { setCookie } from "@/src/shared/lib/cookie";
@@ -41,11 +42,15 @@ i18n.init({
function CommonCodeInitializer() {
const isInit = useWrStore((state) => state.code.isInit);
const initCommonCodes = useWrStore((state) => state.initCommonCodes);
const pathname = usePathname();
const isLoginPage =
pathname === "/auth/login" || pathname?.startsWith("/auth/login/");
useEffect(() => {
if (isLoginPage) return;
if (isInit) return;
initCommonCodes();
}, [isInit, initCommonCodes]);
}, [isInit, initCommonCodes, isLoginPage]);
return null;
}