MarisiaS / SMM

0 stars 0 forks source link

FE -Navigation Bar & Private Routes #86

Closed viriponce closed 3 months ago

viriponce commented 3 months ago

This PR addresses issue #85

Implementation This PR implements a Navigation Bar and Application Bar component. It includes the definition of private routes.

  1. Components: Updated the content of the component NavBar (frontend/src/components/NavBar.jsx). It now renders a Navigation Bar and Application Bar. The Application Bar displays the application name using the AppBar component from MUI. The Navigation Bar display the user navigation options. It implements a responsive drawer.

  2. Protected Routes Inside the src folder, created an utility folder named utils and under it, created a new file to define the private routes called privateRoutes.jsx. It validates if there is a valid token, i.e. the user is authenticated. If the token is valid, the access is granted, if not, the user is redirected to login.

  3. Router

Updated the main.jsx file to include a Router for the App.

  1. App In the App file, redefined the routes in order to include the private routes and the route for the NavBar component. A new route is included for all (*) the invalid urls in order to display a not found error message.

The menu options for the Navigation Bar is defined in this file, when a new option need to be included, the menuOptions needs to be updated with the new option definition. It includes a NotFound component definition in order to display an error message when the user tries to access an invalid URL and a H1 component to display a message.

  1. Login Update navigate route url after login.
Screenshot 2024-05-23 at 6 21 34 AM