Skip to content

Commit

Permalink
Merge pull request #250 from Kernel360/fix-logout
Browse files Browse the repository at this point in the history
페이지 기능: 로그아웃 오류 수정
  • Loading branch information
bottlewook authored Mar 3, 2024
2 parents 06cae8b + 10cd674 commit f704e7a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/app/(my-page)/my-page/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ function MyProfilePage() {
(prev, curr) => { return prev === curr; },
);

// 로그아웃
const handleLoggedOut = () => {
// TODO: 먼저 로그아웃 모달이 뜨도록 할지 논의필요
logout();
};

Expand Down
7 changes: 5 additions & 2 deletions src/hooks/useLoggedOut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f704e7a

Please sign in to comment.