From d6429be9983fc09ee868bb7c49a186e853599e16 Mon Sep 17 00:00:00 2001 From: Srishty M Date: Mon, 25 Mar 2024 15:10:48 +0530 Subject: [PATCH] feat: added validation filter before registering --- src/components/form/FormContainer.jsx | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/components/form/FormContainer.jsx b/src/components/form/FormContainer.jsx index 73c0cb6..e1251e5 100644 --- a/src/components/form/FormContainer.jsx +++ b/src/components/form/FormContainer.jsx @@ -6,6 +6,9 @@ import { donation, feeCoverage, initialContent, inputContent, lastPartContent } import { storeFormData } from '../../firebase/registration'; const FormContainer = () => { + // const { userData } = useContext(AuthContext); + const userData = undefined; + const [isValid, setValid] = useState({ recRollNumber: false, name: false, @@ -33,12 +36,9 @@ const FormContainer = () => { var notAllowed = !checkValidity || checkIfEmpty; //console.log('checkValidity:', checkValidity, 'checkIfEmpty:', isEmpty); - const [errorMessage, setErrorMessage] = useState(''); + const [formData, setFormData] = useState({}); - //const [verified, setVerified] = useState(false); - // const { userData } = useContext(AuthContext); - const userData = undefined; //console.log('formData:', formData); const setInputValue = (key, value) => { @@ -76,16 +76,6 @@ const FormContainer = () => { const documentId = await storeFormData(formData); console.log('Document ID:', documentId); window.alert('Registration Successful'); - - setFormData({ - recRollNumber: '', - name: '', - email: '', - country: '', - state: '', - city: '', - contactNumber: '', - }); } catch (error) { console.error('Error:', error); window.alert('Registration Failed');