codersforcauses / codersforcauses/transplant

Connect log in page to the backend

Open
#58 1 comment 0 reactions 2 assignees Claimed by @melbauerr View on GitHub
backend difficulty::medium priority::high
Dominant language
TypeScript
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

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)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.