fix, remove:

- 권한 체크를 최초 실행시만이 아니라 pathname 변경시로 변경.
- hostname 로그 삭제
This commit is contained in:
swcho
2025-10-15 13:37:13 +09:00
parent b3480556ee
commit 4bcef0fff1
@@ -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}</>;
};