diff --git a/src/components/Modal/ModalRegistration/ModalRegistration.jsx b/src/components/Modal/ModalRegistration/ModalRegistration.jsx index df089e29..83e3118b 100644 --- a/src/components/Modal/ModalRegistration/ModalRegistration.jsx +++ b/src/components/Modal/ModalRegistration/ModalRegistration.jsx @@ -129,12 +129,14 @@ export const ModalRegistration = ({ active, setActive }) => { ) : ( { + onClick={async (e) => { e.preventDefault(); setLoader(true); - handleSubmit(e); + const result = await handleSubmit(e); + if (result === true) { + closeModal(); + } setLoader(false); - closeModal(); }} styles="button-box__submit" > diff --git a/src/hooks/useFormValidation.js b/src/hooks/useFormValidation.js index 40ac4f31..f19880e5 100644 --- a/src/hooks/useFormValidation.js +++ b/src/hooks/useFormValidation.js @@ -102,6 +102,9 @@ export const useFormValidation = ( } catch (error) { console.error("Error submitting form:", error); } + return true; + } else { + return false; } };