boolean-uk / team-dev-frontend-client

1 stars 11 forks source link

Authentication for accessing ProfileEdit #108

Closed Dex491 closed 1 year ago

Dex491 commented 1 year ago

Auth checks in ProfileEdit

dogezen commented 1 year ago

I would suggest passing the loggedInUser from app.js to your ProfilePage.

Inside that component then you can check: if loggedInUser is teacher, you render TeacherProfilePage, if not, you render StudentProfilePage (or just have 1 single profile page with conditional rendering)

You should put the ROUTE for the profile pages inside the <Route element={<AuthenticateUser />}> in app.js so that it guarantees the user is at least logged in or automatically redirects to login if not.