SE701-T5 / Frontend

This is the frontend repo of Uni-forum, associated with the University of Auckland, SOFTENG701. This repo will be linked to Netlify for ease of deployment and code review
MIT License
1 stars 22 forks source link

Connect authentication-Login & Register Page to the Backend endpoints #78

Open Xiaoqi510 opened 2 years ago

Xiaoqi510 commented 2 years ago

Description: Currently the frontend and backend are unconnected.

It would be great if you could connect the login and register page to the backend part. Because now in the frontend part, all user details are pre-defined and stored in the LocalStorage, using React Hook-useContext to pass user data through all the required components(you can find related code in/src/context/AuthProvider.jsx). Note: now we haven't set the login/register page as our default route, so please use https://deploy-preview-58--uniforum.netlify.app/login to jump to the login page.

Screen Shot 2022-03-20 at 10 54 30 PM

Things you need to do is fetch the real data from the database for login page and submit/post the registered form data to the database. The full Heroku POST endpoint you need to be hitting is https://uni-forum.herokuapp.com/api/v1/users/login for login page The full Heroku POST endpoint you need to be hitting is https://uni-forum.herokuapp.com/api/v1/users/ for register page

Pre-requisites:

make sure the consistency of the password constraints in frontend and backend part. (it's currently not same, in frontend part, we set password:"Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters", and in the backend part, just "reqBody.password.length > 0")

How to get started:

use the axios "api" instance inside the api folder to make the api calls to the backend https://axios-http.com/docs/instance