fix auth errors and add tracker-registration
This commit is contained in:
parent
2ed0be6664
commit
176dd29625
@ -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,18 +47,14 @@ export const TrackerRegistration = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const {
|
||||
formData,
|
||||
validationErrors,
|
||||
handleChange,
|
||||
handleSubmit,
|
||||
} = useFormValidation(
|
||||
const { formData, validationErrors, handleChange, handleSubmit } =
|
||||
useFormValidation(
|
||||
apiEndpoint,
|
||||
fields,
|
||||
showNotificationError,
|
||||
showNotificationTrue,
|
||||
isPartner,
|
||||
setLoader,
|
||||
setLoader
|
||||
);
|
||||
return (
|
||||
<div className="tracker-registration">
|
||||
|
Loading…
Reference in New Issue
Block a user