Skip to content

Instantly share code, notes, and snippets.

@azeezat
Last active April 8, 2021 12:56
Show Gist options
  • Save azeezat/20f89c45c017474d08124d78af91fbaf to your computer and use it in GitHub Desktop.
Save azeezat/20f89c45c017474d08124d78af91fbaf to your computer and use it in GitHub Desktop.
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