From 72c1b4e3a60b5855575bd29a7e3df74bb75c16a9 Mon Sep 17 00:00:00 2001 From: Hemant2335 Date: Sat, 25 Nov 2023 19:54:00 +0530 Subject: [PATCH] testing_for_pr --- frontend/src/Login/Signup.tsx | 40 +++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/frontend/src/Login/Signup.tsx b/frontend/src/Login/Signup.tsx index dae3dd83..b39802fd 100644 --- a/frontend/src/Login/Signup.tsx +++ b/frontend/src/Login/Signup.tsx @@ -1,11 +1,32 @@ -import React from 'react'; +import React, { useState } from 'react'; import DocsGPT3 from '../assets/cute_docsgpt3.svg'; import { useNavigate } from 'react-router-dom'; export default function Signup() { + const [showalert, setshowalert] = useState(''); + const [email, setemail] = useState(''); + const [password, setpassword] = useState(''); + const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); + //email validation + if (email.length === 0 || password.length === 0) { + if (password.length === 0) { + setshowalert('Password is required'); + return; + } else { + setshowalert('Email is required'); + } + return; + } else { + setshowalert(''); + } + if (password.length === 0) { + setshowalert('Password is required'); + return; + } + alert('Signup Successful '); navigate('/login'); @@ -34,27 +55,34 @@ export default function Signup() { type="email" name="Name" placeholder="Email" + onChange={(e) => { + setemail(e.target.value); + }} className="w-full rounded-lg border-none bg-[#2B2B2B] p-4 text-sm font-medium text-white focus:outline-none md:min-w-[25vw]" - // onChange={onchange} /> { + setpassword(e.target.value); + }} className="w-full rounded-lg border-none bg-[#2B2B2B] p-4 text-sm font-medium text-white focus:outline-none md:min-w-[25vw]" - // onChange={onchange} /> - + {showalert.length > 0 && ( +
{showalert}
+ )}

Already have an account ?

navigate('/login')} > - Log in + log in