Skip to content

Commit

Permalink
✨ feat: 로그아웃시 스토어도 정리 #70
Browse files Browse the repository at this point in the history
  • Loading branch information
froggy1014 committed Oct 13, 2024
1 parent 887127f commit 12fb5da
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/app/(route)/mypage/_components/MypageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ import Link from "next/link";
import { signOut } from "next-auth/react";

import { LogoutIcon, SettingIcon } from "@/components/icons";
import { useUserStore } from "@/store/user";

const MypageHeader = () => {
const setUser = useUserStore((state) => state.updateUser);

const handleSignOut = () => {
setUser(null);
signOut();
};

return (
<header className="flex h-[44px] w-full items-center justify-end gap-[16px] px-[10px]">
<Link href="/mypage/settings" prefetch>
Expand All @@ -15,7 +23,7 @@ const MypageHeader = () => {
className="text-gray-scale-900"
/>
</Link>
<button type="button" onClick={() => signOut()}>
<button type="button" onClick={handleSignOut}>
<LogoutIcon
width="28px"
height="28px"
Expand Down

0 comments on commit 12fb5da

Please sign in to comment.