From bca1b096fa6d19a27b50f42bb34848df122d5560 Mon Sep 17 00:00:00 2001 From: Vidwa De Seram Date: Thu, 4 Jan 2024 18:45:46 +0530 Subject: [PATCH] route protect -done --- client/src/App.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/client/src/App.js b/client/src/App.js index d7e4875..2281f46 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -47,7 +47,7 @@ function App() { function ProtectedRoute({ children }) { const isLoggedIn = useSelector((state) => state.auth.isLoggedIn); const token = localStorage.getItem("token"); - if (!isLoggedIn & token) { + if (!isLoggedIn & !token) { Swal.fire({ title: "Unauthorized Access", text: "You need to log in to access this page", @@ -119,7 +119,14 @@ function App() { } /> - + + + + } + />