diff --git a/src/components/Modal/ModalRegistration/ModalRegistration.jsx b/src/components/Modal/ModalRegistration/ModalRegistration.jsx index 5f109475..8123d88f 100644 --- a/src/components/Modal/ModalRegistration/ModalRegistration.jsx +++ b/src/components/Modal/ModalRegistration/ModalRegistration.jsx @@ -23,8 +23,8 @@ export const ModalRegistration = ({ active, setActive }) => { const [inputsError, setInputsError] = useState({ name: false, email: false, - password: false - }) + password: false, + }); const validateEmail = (email) => { // регулярное выражение для проверки email @@ -46,22 +46,26 @@ export const ModalRegistration = ({ active, setActive }) => { const validateForm = () => { if (inputsValue.password.length < 6) { - setInputsError((prevValue) => ({...prevValue, password: true})) + setInputsError((prevValue) => ({ ...prevValue, password: true })); } if (inputsValue.userName.length < 6) { - setInputsError((prevValue) => ({...prevValue, name: true})) + setInputsError((prevValue) => ({ ...prevValue, name: true })); } if (!validateEmail(inputsValue.email)) { - setInputsError((prevValue) => ({...prevValue, email: true})) + setInputsError((prevValue) => ({ ...prevValue, email: true })); } - if (inputsValue.password.length < 6 || inputsValue.userName.length < 6 || !validateEmail(inputsValue.email)) { - return true + if ( + inputsValue.password.length < 6 || + inputsValue.userName.length < 6 || + !validateEmail(inputsValue.email) + ) { + return true; } - } + }; const submitHandler = () => { - if(validateForm()) { - return + if (validateForm()) { + return; } apiRequest("/register/sign-up", { method: "POST", @@ -101,75 +105,69 @@ export const ModalRegistration = ({ active, setActive }) => {