From ef6263ab21ca6eb8eb4554387ce8d49408159a47 Mon Sep 17 00:00:00 2001 From: M M Date: Thu, 6 Jun 2024 17:39:15 -0700 Subject: [PATCH 1/2] Encode user input from text fields into a JSON object. --- Client/src/Pages/Login/index.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/Client/src/Pages/Login/index.jsx b/Client/src/Pages/Login/index.jsx index 4a621e889..593e2d0d3 100644 --- a/Client/src/Pages/Login/index.jsx +++ b/Client/src/Pages/Login/index.jsx @@ -1,4 +1,3 @@ -import React from "react"; import "./index.css"; import BackgroundPattern from "../../Components/BackgroundPattern/BackgroundPattern"; import Logomark from "../../assets/Images/Logomark.png"; From 61e460e940aa58a1913970ea7891204fe6d0697a Mon Sep 17 00:00:00 2001 From: M M Date: Thu, 6 Jun 2024 17:41:09 -0700 Subject: [PATCH 2/2] Update commit with latest code. --- Client/src/Pages/Login/index.jsx | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Client/src/Pages/Login/index.jsx b/Client/src/Pages/Login/index.jsx index 593e2d0d3..19edcf6f0 100644 --- a/Client/src/Pages/Login/index.jsx +++ b/Client/src/Pages/Login/index.jsx @@ -1,3 +1,4 @@ +import { useState } from "react"; import "./index.css"; import BackgroundPattern from "../../Components/BackgroundPattern/BackgroundPattern"; import Logomark from "../../assets/Images/Logomark.png"; @@ -8,6 +9,24 @@ import Google from "../../assets/Images/Google.png"; import PasswordTextField from "../../Components/TextFields/Password/PasswordTextField"; const Login = () => { + const idMap = { + "login-email-input": "email", + "login-password-input": "password", + }; + + const [form, setForm] = useState({ + email: "", + password: "", + }); + + const handleInput = (e) => { + const fieldName = idMap[e.target.id]; + setForm({ + ...form, + [fieldName]: e.target.value, + }); + }; + return (
@@ -24,15 +43,17 @@ const Login = () => {