From 86cb97b5ac25523f68782191bb30182644d0392c Mon Sep 17 00:00:00 2001 From: judahhh Date: Fri, 20 Oct 2023 15:05:59 +0900 Subject: [PATCH] =?UTF-8?q?chore=20:=20=EC=98=88=EC=8B=9C=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EC=83=9D=EC=84=B1=20=EB=B0=8F=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=EC=83=81=ED=83=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + src/App.tsx | 3 +++ src/pages/redirect/PrivateRoute.tsx | 8 +++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 438657a9..6f23d44f 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ dist dist-ssr *.local .env +src/pages/example # Editor directories and files .vscode/* diff --git a/src/App.tsx b/src/App.tsx index e444b92e..72ec3733 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -4,6 +4,7 @@ import AdminPage from '@/pages/admin' import AdminLoginPage from '@/pages/admin/AdminLogin' import ChatListPage from '@/pages/chatList' import ChattingPage from '@/pages/chatting' +import ExamplePage from '@/pages/example' import HomePage from '@/pages/home' import LandingPage from '@/pages/landing' import LoginPage from '@/pages/login' @@ -21,6 +22,7 @@ const App = () => { } /> } /> } /> + }> }> @@ -29,6 +31,7 @@ const App = () => { } /> } /> } /> + }> }> diff --git a/src/pages/redirect/PrivateRoute.tsx b/src/pages/redirect/PrivateRoute.tsx index 567595e0..6798ad5a 100644 --- a/src/pages/redirect/PrivateRoute.tsx +++ b/src/pages/redirect/PrivateRoute.tsx @@ -5,13 +5,15 @@ type PrivateRouteProps = { superAuth?: boolean } +type LoginStatus = 'true' | 'false' + const PrivateRoute = ({ auth }: PrivateRouteProps) => { - const isLogin = localStorage.getItem('isLogin') + const isLogin: LoginStatus = 'true' if (auth) { - return isLogin === null || isLogin == 'false' ? : + return isLogin !== 'true' ? : } else { - return isLogin === null || isLogin == 'false' ? : + return isLogin !== 'true' ? : } }