From 81f5139f4296d0c1c3561dd670cedad971696cac Mon Sep 17 00:00:00 2001 From: JW-Ahn0 Date: Wed, 8 Jan 2025 17:43:22 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20useFetchSession=ED=9B=85=20isError?= =?UTF-8?q?=EC=8B=9C=20null=20=EA=B0=92=20=EC=A0=84=EB=8B=AC=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useFetchSession.ts | 2 +- src/pages/guards/LoginGuard.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hooks/useFetchSession.ts b/src/hooks/useFetchSession.ts index ec541d6c..dfbc6985 100644 --- a/src/hooks/useFetchSession.ts +++ b/src/hooks/useFetchSession.ts @@ -10,7 +10,7 @@ export const useFetchSession = () => { retry: false, }); return { - sessionUser: data, + sessionUser: isError ? null : data, isLoading, isError, }; diff --git a/src/pages/guards/LoginGuard.tsx b/src/pages/guards/LoginGuard.tsx index 110f5986..e4251e64 100644 --- a/src/pages/guards/LoginGuard.tsx +++ b/src/pages/guards/LoginGuard.tsx @@ -10,13 +10,13 @@ interface ILoginGuardProps { * 로그인한 사용자가 로그인 페이지 접근 시 처리 */ export const LoginGuard = ({ children }: ILoginGuardProps) => { - const { sessionUser, isLoading, isError } = useFetchSession(); + const { sessionUser, isLoading } = useFetchSession(); if (isLoading) { return null; } - if (!isError && sessionUser) { + if (sessionUser) { return ; }