auth-check #25
@ -87,22 +87,23 @@ export const useFormValidation = (
|
||||
e.preventDefault();
|
||||
// Проверка валидации формы
|
||||
if (validateForm()) {
|
||||
setLoader(true)
|
||||
setLoader(true);
|
||||
let newformData = { ...formData, is_partner: isPartner ? 1 : 0 };
|
||||
delete newformData.secondPassword;
|
||||
|
||||
|
||||
try {
|
||||
apiRequest(apiEndpoint, {
|
||||
method: "POST",
|
||||
data: newformData
|
||||
}).then((data) => {
|
||||
setLoader(false)
|
||||
setLoader(false);
|
||||
if ("errors" in data) {
|
||||
return showNotificationError('Аккаунт с таким логином или email уже существуе');
|
||||
return showNotificationError(
|
||||
"Аккаунт с таким логином или email уже существуе"
|
||||
);
|
||||
}
|
||||
if (!data.id) {
|
||||
return showNotificationError('Ошибка');
|
||||
return showNotificationError("Ошибка");
|
||||
}
|
||||
handleClearForm();
|
||||
showNotificationTrue();
|
||||
|
@ -5,7 +5,9 @@ import { useFormValidation } from "@hooks/useFormValidation";
|
||||
import { useNotification } from "@hooks/useNotification";
|
||||
|
||||
import { AuthHeader } from "@components/Common/AuthHeader/AuthHeader";
|
||||
import BaseButton from "@components/Common/BaseButton/BaseButton";
|
||||
import { Footer } from "@components/Common/Footer/Footer";
|
||||
import { Loader } from "@components/Common/Loader/Loader";
|
||||
import ModalLayout from "@components/Common/ModalLayout/ModalLayout";
|
||||
import { ModalTrackerRegistration } from "@components/Modal/ModalTrackerRegistration/ModalTrackerRegistration";
|
||||
import SideBar from "@components/SideBar/SideBar";
|
||||
@ -15,8 +17,6 @@ import authImg from "assets/images/partnerProfile/authCandidateFormImg.png";
|
||||
import registrationImg from "assets/images/trackerRegistrationImg.png";
|
||||
|
||||
import "./trackerRegistration.scss";
|
||||
import { Loader } from "@components/Common/Loader/Loader";
|
||||
import BaseButton from "@components/Common/BaseButton/BaseButton";
|
||||
|
||||
export const TrackerRegistration = () => {
|
||||
const [modalConfirmOpen, setModalConfirm] = useState(false);
|
||||
@ -47,19 +47,15 @@ export const TrackerRegistration = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const {
|
||||
formData,
|
||||
validationErrors,
|
||||
handleChange,
|
||||
handleSubmit,
|
||||
} = useFormValidation(
|
||||
apiEndpoint,
|
||||
fields,
|
||||
showNotificationError,
|
||||
showNotificationTrue,
|
||||
isPartner,
|
||||
setLoader,
|
||||
);
|
||||
const { formData, validationErrors, handleChange, handleSubmit } =
|
||||
useFormValidation(
|
||||
apiEndpoint,
|
||||
fields,
|
||||
showNotificationError,
|
||||
showNotificationTrue,
|
||||
isPartner,
|
||||
setLoader
|
||||
);
|
||||
return (
|
||||
<div className="tracker-registration">
|
||||
<AuthHeader />
|
||||
|
Loading…
Reference in New Issue
Block a user