From the course: React: Cloud-Powered Apps with Firebase

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Authenticated user redirect

Authenticated user redirect

From the course: React: Cloud-Powered Apps with Firebase

Start my 1-month free trial

Authenticated user redirect

- Before wrapping up our work on authentication, we need to address a couple of issues. Let me show you what I mean. Let's go ahead and log in (keyboard clicking) Upon login, I am redirected to the profile page. However, I can still visit both the login page, and also the signup page. In addition, the logout button appears. In this scenario which redirects the user back to the profile page, and not allow them to visit these pages. Let's tackle the SQL. Let's go ahead and create a new folder called router, which will contain all the files we related to routing. We will create a new file call ProfileRedirect.js. This will be a high-order component that will check for a user session and redirect accordingly. This component will render the desired component if there is no user session. Otherwise, it will redirect the user back to the profile page. Let's go ahead and import react from react. We will also import route, and…

Contents