diff --git a/apps/sn/src/entities/auth/lib/auth-wrapper.tsx b/apps/sn/src/entities/auth/lib/auth-wrapper.tsx index c42866c9b..289a97087 100644 --- a/apps/sn/src/entities/auth/lib/auth-wrapper.tsx +++ b/apps/sn/src/entities/auth/lib/auth-wrapper.tsx @@ -1,7 +1,7 @@ "use client"; import { useEffect } from "react"; -import { useRouter } from "next/navigation"; +import { useRouter, usePathname } from "next/navigation"; import { client } from "@/shared/api"; import type { IUserInfo } from "@/shared/store"; import { useUserStore } from "@/shared/lib"; @@ -14,6 +14,7 @@ const LOGIN_PAGE_URL = process.env.NEXT_PUBLIC_CM_LOGIN_PAGE_URL || "http://dev. const AuthWrapper = ({ children }: { children: React.ReactNode }) => { const router = useRouter(); + const pathname = usePathname(); const { userInfo, setUserInfo } = useUserStore((state) => state); async function authCheck() { @@ -43,7 +44,6 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => { setUserInfo(null); const hostname = window.location.hostname; - console.log("Current hostname:", hostname); // 개발 환경에서는 localhost 도메인 사용 if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "con.mind-one.co.kr") @@ -55,7 +55,7 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => { } } })(); - }, []); + }, [pathname]); return <>{children}; };