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

Create Private Route Component #230

Open
rcamach7 opened this issue Jul 28, 2023 · 4 comments · May be fixed by #234
Open

Create Private Route Component #230

rcamach7 opened this issue Jul 28, 2023 · 4 comments · May be fixed by #234
Assignees
Labels
front-end front-end related issue good first issue Good for newcomers

Comments

@rcamach7
Copy link
Collaborator

Why?

  • When users are logged in, they should not be able to visit certain pages.
    • currenlty the redirect happens within each private page. For example, HomePage and Profile component use a hook to check if the user is logged in, and redirects them if not.
  • We want to make a component that can be used across all private routes, without making the actual page component worry about this

How?

  • Create a PrivateRoute component.
    • It will use userContext to pull user information. If user does not exist, redirect user to the login page. If user exists, allow the page to be displayed
    • there are several ways to build this. You can look at this example to get an idea
  • Use this PrivateRoute on all pages in the Routes file that only logged in users should be able to visit
  • remove the previous logic in these components that used a hook to redirect users
@rcamach7 rcamach7 added help wanted Extra attention is needed good first issue Good for newcomers front-end front-end related issue labels Jul 28, 2023
@rcamach7 rcamach7 removed the help wanted Extra attention is needed label Jul 29, 2023
@Owobilum Owobilum linked a pull request Aug 8, 2023 that will close this issue
@ramya202000
Copy link

Hi!

I would like work on this. Could anyone please guide me?

@lugenx
Copy link
Owner

lugenx commented Aug 9, 2023

Hey @ramya202000,
Thanks for your interest! This issue is already in a PR and being reviewed.
Feel free to check out other issues or join our Discord to chat and get updates.

@lugenx lugenx assigned lugenx and unassigned lugenx Aug 9, 2023
@lugenx lugenx linked a pull request Aug 9, 2023 that will close this issue
@Owobilum
Copy link

Hello! Please assign this to me

@lugenx
Copy link
Owner

lugenx commented Aug 10, 2023

Hello! Please assign this to me

just to clarify, PR already was created by @Owobilum before, I have asked him to leave this comment, this way GitHub allows me to assign this to him.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
front-end front-end related issue good first issue Good for newcomers
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

4 participants