Closed Dex491 closed 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.
Auth checks in ProfileEdit
loggedInUser.id
≠profileToEdit.id
- navigate back to the profile page of the id they wanted to editloggedInUser.id
doesn’t match theprofileToEdit.id