After setting up the user authentication system, it is time for us to add a dashboard to our SaaS app. This dashboard should only be accessible to authenticated users, and it should provide them with options to update user information, such as the name and email address.
Updating the navbar
Let's start with the navbar, our navigation menu needs to be updated to show a Get Started button for unauthenticated users and a Dashboard button for authenticated users.
For unauthenticated users:
For authenticated users:
In order to achieve this, we need to retrieve the user session in our navbar component.
If the session
exists, user is authenticated, and the Dashboard button will be displayed. If the session
does not exist, user is not authenticated, and the Get Started button will be displayed instead.
components/navbar.jsx