HackYourFuture-CPH / FP-annotatetheweb-class10

Final Project for Class10 - Annotatetheweb.com
MIT License
3 stars 0 forks source link

Add private routing #79

Closed zkwsk closed 4 years ago

zkwsk commented 4 years ago

Description

Build a component <PrivateRoute> that determines whether a user is authenticated and authorized to view a given page.

If the user is authorized to view a given page return a regular <Route> component showing the given page. If not, redirect the user to the login component.

You can check the previous final project for inspiration: https://github.com/HackYourFuture-CPH/ov-class09-fp/blob/develop/src/client/components/PrivateRoute.js

Route Strucuture

(You don't need to make the above components functional in this task, but it would be nice if you create placeholder components, so if you access for example /user you see a text saying "user page" - just to verify that routing is working correctly)

Stretch goal:

Pass the original requested route to the login page component and make sure to redirect the user to the right route after succesful login.