Changeset 0f5aa27 for frontend/src/Components/Misc
- Timestamp:
- 02/04/24 16:57:49 (10 months ago)
- Branches:
- master
- Children:
- efaa053
- Parents:
- 07f4e8b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
frontend/src/Components/Misc/PrivateRoute.js
r07f4e8b r0f5aa27 5 5 function PrivateRoute({ children }) { 6 6 const { userIsAuthenticated } = useAuth() 7 return userIsAuthenticated() ? children : <Navigate to="/login" /> 7 if(userIsAuthenticated()) 8 { 9 return children; 10 } 11 else 12 { 13 window.location.href = "http://localhost:8080/login"; 14 } 15 return userIsAuthenticated() ? children : <Navigate to="http://localhost:8080/login" /> 8 16 } 9 17
Note:
See TracChangeset
for help on using the changeset viewer.