Skip to content

Commit

Permalink
Refactor(mogua-station#132): useSignOut 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Stilllee committed Feb 12, 2025
1 parent b831d2e commit d133763
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/hooks/auths/useSignOut.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
"use client";

import { useRouter } from "next/navigation";
import useUserStore from "@/store/auth/useUserStore";

const useSignOut = () => {
const router = useRouter();
const clearUser = useUserStore((state) => state.clearUser);

const handleSignOut = async () => {
clearUser();
try {
router.push("/");

setTimeout(() => {
clearUser();
}, 100);
} catch (error) {
console.error("로그아웃 중 에러 발생:", error);
}
};

return { handleSignOut };
Expand Down

0 comments on commit d133763

Please sign in to comment.