emilyjmaloney / find-a-tutor-app-front-end

first repo created for the final front end project
0 stars 0 forks source link

NewNavBar login/logout Button #13

Closed emilyjmaloney closed 3 years ago

emilyjmaloney commented 3 years ago

Logout should return user to homepage.

Create code for the login/logout button in the navbar so that when the logout button is pressed, the user is routed back to the homepage.

emilyjmaloney commented 3 years ago

Here is how to do it: Login / Logout Button in NewNavBar: (Make Changes to Account Component) Add a conditional render in the account component If token on store – render what it shows now If no token in store, redirect user to login page (so when user clicks on logout – they are redirected to the loin page) Use a component to react router tag = Redirect (just like “Link to” component) – receives a property like the “Link to” to login Google “redirect react router” to find login / logout button code