generated from codersforcauses/django-nextjs-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
backendTask must have a back end issueTask must have a back end issuedifficulty::mediumpriority::high
Description
Connect the log in form to the backend! Here, we will need to use the existing useAuth()
hook in useUser.tsx
.
This will return a method that accepts the email and password, sends it to the backend, and returns a Boolean based on if the user was successfully logged in. An example log in modal from coexist can be found here: https://github.com/codersforcauses/coexist/blob/main/client/src/components/modal/sign-in.tsx
Things to do:
- use react hook form (or another method of your choosing) to get values from the email and password fields of the form
- use the login method from useAuth() to send a request to the backend with the username and password
- alter our user method to return a boolean based on whether the user was successfully logged in or not (log in is considered successful if response has status 200 and data). Currently it returns error information, if you want to work with that its probably fine too.
- if login was a success, redirect to landing page (will be swapped to home screen once ready)
- if not, display some kind of placeholder error message (doesnt have to be fancy)
Metadata
Metadata
Assignees
Labels
backendTask must have a back end issueTask must have a back end issuedifficulty::mediumpriority::high