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