Skip to content

Connect log in page to the backend #58

@laurenpudz

Description

@laurenpudz

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions