From 8160136d38ed9f876ad0b4acc9e1df9dacd0a257 Mon Sep 17 00:00:00 2001 From: young Date: Thu, 13 Mar 2025 23:06:42 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=EC=9D=B8=EC=A6=9D=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EA=B2=80=EC=82=AC=20=EB=A1=9C=EC=A7=81=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 175c94a0..cf20b1b7 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -37,9 +37,17 @@ const ProtectedRoute = ({ children }: { children: JSX.Element }) => { useEffect(() => { const checkAuth = async () => { - const currentUserId = getCurrentUserId(); - const response = await getUserInfoApi(currentUserId); - setIsAuthenticated(response.isSuccess); + try { + const currentUserId = getCurrentUserId(); + if (!currentUserId) { + setIsAuthenticated(false); + return; + } + + await getUserInfoApi(currentUserId); + } catch (error) { + setIsAuthenticated(false); + } }; checkAuth(); }, []); From f4ed3eb69f50cac1108516f40c3e716b6ce384cc Mon Sep 17 00:00:00 2001 From: young Date: Thu, 13 Mar 2025 23:10:33 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=EC=9D=B8=EC=A6=9D=EB=90=9C=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=20=ED=95=B4=EB=8B=B9=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index cf20b1b7..28bea8f1 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -44,7 +44,8 @@ const ProtectedRoute = ({ children }: { children: JSX.Element }) => { return; } - await getUserInfoApi(currentUserId); + const response = await getUserInfoApi(currentUserId); + setIsAuthenticated(response.isSuccess); } catch (error) { setIsAuthenticated(false); }