From 10cd6743f2c3b981087b45016023d88c61663d93 Mon Sep 17 00:00:00 2001 From: bottlewook Date: Mon, 4 Mar 2024 00:25:56 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95=20#249?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(my-page)/my-page/page.tsx | 2 -- src/hooks/useLoggedOut.ts | 7 +++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/(my-page)/my-page/page.tsx b/src/app/(my-page)/my-page/page.tsx index ec81c75b..7644e463 100644 --- a/src/app/(my-page)/my-page/page.tsx +++ b/src/app/(my-page)/my-page/page.tsx @@ -28,9 +28,7 @@ function MyProfilePage() { (prev, curr) => { return prev === curr; }, ); - // 로그아웃 const handleLoggedOut = () => { - // TODO: 먼저 로그아웃 모달이 뜨도록 할지 논의필요 logout(); }; diff --git a/src/hooks/useLoggedOut.ts b/src/hooks/useLoggedOut.ts index e28a0d83..3c6fea77 100644 --- a/src/hooks/useLoggedOut.ts +++ b/src/hooks/useLoggedOut.ts @@ -11,10 +11,13 @@ function useLoggedOut() { const query = useQueryClient(); const logout = (redirectPath = '/') => { - dispatch(clearUserId()); + router.push(redirectPath); removeCookie('token', { path: '/' }); query.clear(); - router.push(redirectPath); + const clearId = setTimeout(() => { + dispatch(clearUserId()); + }, 1000); + clearTimeout(clearId); }; return logout;