Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protected and Public routes implemented in client side #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kaushik27mishra
Copy link

I have made two types of Routes using react-router which will allow to control the logged in as well as a new user.

  1. Public Route :- For the case when the user is already logged in so, we should not allow the user to visit the login and signup page. If the user tries to acess these pages, it will redirect the user to the main app page.
  2. Private Route :- For the case when the user is not logged in we shouldn't allow the user to go inside our main app. It will redirect the user to login page. If the user tries to acess these pages, it will redirect the user to the login page.

I am controlling these events using a simple boolean value isAuthenticated which needs to be stored in the react context or redux store.

@mohit355 mohit355 requested a review from aashimgarg November 14, 2020 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant