From 9984059f9db299e668372194a4cf5c5066a0a175 Mon Sep 17 00:00:00 2001 From: swcho Date: Wed, 15 Oct 2025 13:48:08 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EA=B6=8C=ED=95=9C=20=EC=B2=B4=ED=81=AC?= =?UTF-8?q?=EB=A5=BC=20=EC=B5=9C=EC=B4=88=20=EC=8B=A4=ED=96=89=EC=8B=9C?= =?UTF-8?q?=EB=A7=8C=EC=9D=B4=20=EC=95=84=EB=8B=88=EB=9D=BC=20pathname=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=EC=8B=9C=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/src/entities/auth/lib/auth-wrapper.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/fo/src/entities/auth/lib/auth-wrapper.tsx b/apps/fo/src/entities/auth/lib/auth-wrapper.tsx index 9a632ca17..f57ae7f6d 100644 --- a/apps/fo/src/entities/auth/lib/auth-wrapper.tsx +++ b/apps/fo/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 "@/src/shared/api"; import type { IUserInfo } from "@/src/shared/store"; import { useUserStore, getCookie } from "@/src/shared/lib"; @@ -12,6 +12,7 @@ const LOGIN_PAGE_URL = process.env.NEXT_PUBLIC_DEV_CM_LOGIN_PAGE_URL || "http:// const AuthWrapper = ({ children }: { children: React.ReactNode }) => { const router = useRouter(); + const pathname = usePathname(); const { userInfo, setUserInfo } = useUserStore((state) => state); async function authCheck() { @@ -43,7 +44,8 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => { const hostname = window.location.hostname; // 개발 환경에서는 localhost 도메인 사용 - if (hostname === "localhost" || hostname === "127.0.0.1") router.push("/"); // 개발시 홈으로 돌아가기 + if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "con.mind-one.co.kr") + router.push("/"); // 개발시 홈으로 돌아가기 // 운영 환경에서는 서브도메인을 포함한 최상위 도메인 사용 // router.push는 같은 Next.js 앱 내에서만 작동하므로 다른 앱으로 이동할 때는 window.location.href 사용 @@ -51,7 +53,7 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => { } } })(); - }, []); + }, [pathname]); return <>{children}; };