Closed emilyjmaloney closed 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
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.