Last active
April 8, 2021 12:56
-
-
Save azeezat/20f89c45c017474d08124d78af91fbaf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { appRoutes } from "../constants"; | |
import { useAuthContext } from "../contexts"; | |
const ProtectedRoute = ({ router, children }) => { | |
//Identify authenticated user | |
const { user } = useAuthContext(); | |
const isAuthenticated = user.isLoggedIn; | |
let unprotectedRoutes = [ | |
appRoutes.LOGIN_PAGE, | |
appRoutes.FORGOT_PASSWORD, | |
appRoutes.RESET_PASSWORD, | |
appRoutes.EMAIL_SENT, | |
appRoutes.VERIFY_EMAIL, | |
appRoutes.NEWS_FEED_PAGE, | |
appRoutes.CONTENT_DETAILS_PAGE, | |
appRoutes.ABOUT_US_PAGE, | |
]; | |
return children; | |
}; | |
export default ProtectedRoute; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment