Connected login to backend

This commit is contained in:
Alex Holliday committed 2024-06-10 11:53:10 -07:00
1 parent 91891b1a90
commit 9beebd90a1
3 files changed
+70 -3

No files matched your search

+9
View File
@@ -54,6 +54,15 @@ const Register = () => {
}, []);
const handleInput = (e) => {
const fieldName = idMap[e.target.id];
// Extract and validate individual fields as input changes
const fieldSchema = registerValidation.extract(fieldName);
const { error } = fieldSchema.validate(e.target.value);
let errMsg = "";
if (error) {
errMsg = error.message;
}
setErrors({ ...errors, [fieldName]: errMsg });
const newForm = { ...form, [idMap[e.target.id]]: e.target.value };
setForm(newForm);
};