261102_02_ENH: 공용 인증 쿠키 도메인 적용 조건 수정 및 외부 링크 인증 탭별 분리
This commit is contained in:
@@ -3,18 +3,20 @@
|
||||
import { useEffect, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useLogoutMutation } from "@/query/auth";
|
||||
import { useAuth } from "@/hooks/useAuth";
|
||||
import { LoadingOverlayAdapter } from "@/components/app-shell/LoadingOverlayAdapter";
|
||||
|
||||
export default function LogoutPage() {
|
||||
const router = useRouter();
|
||||
const { hydrated } = useAuth();
|
||||
const logoutMutation = useLogoutMutation();
|
||||
const started = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (started.current) return;
|
||||
if (!hydrated || started.current) return;
|
||||
started.current = true;
|
||||
void logoutMutation.mutateAsync().finally(() => router.replace("/login"));
|
||||
}, [logoutMutation, router]);
|
||||
}, [hydrated, logoutMutation, router]);
|
||||
|
||||
return <LoadingOverlayAdapter force label="로그아웃 중" />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user