Skip to content

feat(frontend): add login behavior

Arnaud Vergnet requested to merge topic/default/frontend into branch/default

This PR adds the api cube to the CW instance and adds support for logging in. For now the url to the backend is hardcoded, but can later be set using env variables.

To handle forms, we use react-hook-forms as it is the library I am the most familiar with and works perfectly for our use cases.

As the nextjs backend cannot know whether a user is logged in or not (does not have access to the token and cannot check its secret), we simply check if the user is on a route different than /login to know if it is logged in or not. When the rest of the app is connected to the CW backend, then a 401 error would logout the user.

For now the logout action simply redirects the user to /login as the api cube lacks a /logout route. Support has been added the the api cube. The logout action properly invalidates the auth cookie.

2024-02-01_17-15-14

Edited by Arnaud Vergnet

Merge request reports

Loading