From 732b70dd02aef908d5009321bc4a4d65d392d466 Mon Sep 17 00:00:00 2001 From: urjimyu <92876819+urjimyu@users.noreply.github.com> Date: Mon, 27 May 2024 22:24:37 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=B9=84=EB=8F=99=EA=B8=B0=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/KakaoLoginPage.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/pages/KakaoLoginPage.tsx b/src/pages/KakaoLoginPage.tsx index 2614bbf..0a3953c 100644 --- a/src/pages/KakaoLoginPage.tsx +++ b/src/pages/KakaoLoginPage.tsx @@ -15,9 +15,8 @@ const KakaoLoginPage = () => { const handlePostKakao = async (code: string) => { try { await postKakao(code); - console.log('KakaoResponse', kakaoResponse); if (!kakaoError && !kakaoLoading && kakaoResponse) { - console.log('이동 전 콘솔 찍히는지 확인', kakaoResponse); + console.log('이동 전 콘솔 확인', kakaoResponse); if (kakaoResponse.isAlreadyUser) { navigate('/delete'); } else { @@ -25,21 +24,25 @@ const KakaoLoginPage = () => { } } } catch (error) { - navigate('/unregistered'); console.log('ERROR', error); + navigate('/unregistered'); } }; useEffect(() => { - useGetToken() - .then((res) => { + const fetchLogin = async () => { + try { + const res = await useGetToken(); if (res) { const token = res.data.access_token; // localStorage.setItem('ACCESS_TOKEN', JSON.stringify(token)); - handlePostKakao(token); + await handlePostKakao(token); } - }) - .catch((err) => console.log(err)); + } catch (err) { + console.log(err); + } + }; + fetchLogin(); }, []); return <>;