diff --git a/apps/sn/app/page.tsx b/apps/sn/app/page.tsx index 83b40887e..fa9a15b7f 100644 --- a/apps/sn/app/page.tsx +++ b/apps/sn/app/page.tsx @@ -26,20 +26,21 @@ export default function Home() { const checkToken = getCookie(AUTH_USER_ID); useEffect(() => { - // const hostname = window.location.hostname; + const hostname = window.location.hostname; + console.log("개발 메인 hostname", hostname); - // if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "con.mind-one.co.kr") { - // if (!checkToken) { - // async function doLogin() { - // try { - // await LoginApi.login({ userId: "CLEANWATER", password: "gktneh12!@" }); - // window.location.href = "/map"; - // } catch (err) { - // console.error("로그인 실패", err); - // } - // } - // doLogin(); - // } else router.push("/map"); - // } else router.push("/map"); + if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "con.mind-one.co.kr") { + if (!checkToken) { + async function doLogin() { + try { + await LoginApi.login({ userId: "CLEANWATER", password: "gktneh12!@" }); + window.location.href = "/map"; + } catch (err) { + console.error("로그인 실패", err); + } + } + doLogin(); + } else router.push("/map"); + } else router.push("/map"); }, []); } diff --git a/apps/sn/src/entities/auth/lib/auth-wrapper.tsx b/apps/sn/src/entities/auth/lib/auth-wrapper.tsx index 5127b1e18..1c27e6fe3 100644 --- a/apps/sn/src/entities/auth/lib/auth-wrapper.tsx +++ b/apps/sn/src/entities/auth/lib/auth-wrapper.tsx @@ -44,21 +44,10 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => { setUserInfo(null); const hostname = window.location.hostname; - const checkToken = getCookie(AUTH_USER_ID); // 개발 환경에서는 localhost 도메인 사용 if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "con.mind-one.co.kr") - if (!checkToken) { - async function doLogin() { - try { - await LoginApi.login({ userId: "CLEANWATER", password: "gktneh12!@" }); - window.location.href = "/map"; - } catch (err) { - console.error("로그인 실패", err); - } - } - doLogin(); - } else router.push("/map"); + window.location.href = "/"; // 운영 환경에서는 서브도메인을 포함한 최상위 도메인 사용 // router.push는 같은 Next.js 앱 내에서만 작동하므로 다른 앱으로 이동할 때는 window.location.href 사용