wr: isInit
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user