From df41b2d478d8d210666f58aaf683f1324bf6cbe1 Mon Sep 17 00:00:00 2001 From: yyypearl Date: Sat, 18 May 2024 22:31:27 +0900 Subject: [PATCH] =?UTF-8?q?fix(#46):=20window=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/auth/page.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/auth/page.tsx b/src/app/auth/page.tsx index 95eb084..9cf5b83 100644 --- a/src/app/auth/page.tsx +++ b/src/app/auth/page.tsx @@ -9,12 +9,13 @@ const Auth = () => { const router = useRouter(); const REST_API_KEY = process.env.NEXT_PUBLIC_REST_API_KEY; const REDIRECT_URI = process.env.NEXT_PUBLIC_REDIRECT_URI; - const AUTHORIZATION_CODE = new URL(window.location.href).searchParams.get( - "code" - ); + ("code"); useEffect(() => { if (typeof window !== "undefined") { + const AUTHORIZATION_CODE = new URL(window.location.href).searchParams.get( + "code" + ); const ACCESS_TOKEN = localStorage.getItem("access_token"); postKakaoToken(ACCESS_TOKEN!!); @@ -48,7 +49,7 @@ const Auth = () => { }) .catch((err) => console.log(err)); } - }, []); + }, [REST_API_KEY, REDIRECT_URI, router]); return null; };