Compare commits
No commits in common. "8797ba07783a1d118abf2c9e9fc5a32de70ccc8f" and "012ef7d4b634e67b26e36fd7cc20fbef3cdc21b7" have entirely different histories.
8797ba0778
...
012ef7d4b6
@ -32,10 +32,10 @@ export const ModalRegistration = ({ active, setActive }) => {
|
|||||||
const apiEndpoint = "/register/sign-up";
|
const apiEndpoint = "/register/sign-up";
|
||||||
|
|
||||||
const { showNotification } = useNotification();
|
const { showNotification } = useNotification();
|
||||||
const showNotificationError = (error) => {
|
const showNotificationError = () => {
|
||||||
showNotification({
|
showNotification({
|
||||||
show: true,
|
show: true,
|
||||||
text: error,
|
text: "Аккаунт с таким логином или email уже существует",
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -58,9 +58,7 @@ export const ModalRegistration = ({ active, setActive }) => {
|
|||||||
fields,
|
fields,
|
||||||
showNotificationError,
|
showNotificationError,
|
||||||
showNotificationTrue,
|
showNotificationTrue,
|
||||||
isPartner,
|
isPartner
|
||||||
setLoader,
|
|
||||||
closeModal
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -144,7 +142,12 @@ export const ModalRegistration = ({ active, setActive }) => {
|
|||||||
<BaseButton
|
<BaseButton
|
||||||
onClick={async (e) => {
|
onClick={async (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
await handleSubmit(e);
|
setLoader(true);
|
||||||
|
const result = await handleSubmit(e);
|
||||||
|
if (result === true) {
|
||||||
|
closeModal();
|
||||||
|
}
|
||||||
|
setLoader(false);
|
||||||
}}
|
}}
|
||||||
styles="button-box__submit"
|
styles="button-box__submit"
|
||||||
>
|
>
|
||||||
|
@ -249,5 +249,6 @@
|
|||||||
|
|
||||||
.loader {
|
.loader {
|
||||||
justify-content: start;
|
justify-content: start;
|
||||||
|
left: 80px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,7 @@ export const useFormValidation = (
|
|||||||
fields,
|
fields,
|
||||||
showNotificationError,
|
showNotificationError,
|
||||||
showNotificationTrue,
|
showNotificationTrue,
|
||||||
isPartner,
|
isPartner
|
||||||
setLoader,
|
|
||||||
closeModal
|
|
||||||
) => {
|
) => {
|
||||||
// Состояние формы, содержащее значения полей
|
// Состояние формы, содержащее значения полей
|
||||||
const [formData, setFormData] = useState(fields);
|
const [formData, setFormData] = useState(fields);
|
||||||
@ -87,7 +85,6 @@ export const useFormValidation = (
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
// Проверка валидации формы
|
// Проверка валидации формы
|
||||||
if (validateForm()) {
|
if (validateForm()) {
|
||||||
setLoader(true);
|
|
||||||
let newformData = { ...formData, is_partner: isPartner ? 1 : 0 };
|
let newformData = { ...formData, is_partner: isPartner ? 1 : 0 };
|
||||||
delete newformData.secondPassword;
|
delete newformData.secondPassword;
|
||||||
|
|
||||||
@ -96,18 +93,12 @@ export const useFormValidation = (
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
data: newformData
|
data: newformData
|
||||||
}).then((data) => {
|
}).then((data) => {
|
||||||
setLoader(false);
|
|
||||||
if ("errors" in data) {
|
if ("errors" in data) {
|
||||||
return showNotificationError(
|
showNotificationError();
|
||||||
"Аккаунт с таким логином или email уже существуе"
|
} else {
|
||||||
);
|
handleClearForm();
|
||||||
|
showNotificationTrue();
|
||||||
}
|
}
|
||||||
if (!data.id) {
|
|
||||||
return showNotificationError("Ошибка");
|
|
||||||
}
|
|
||||||
handleClearForm();
|
|
||||||
showNotificationTrue();
|
|
||||||
closeModal();
|
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error submitting form:", error);
|
console.error("Error submitting form:", error);
|
||||||
|
@ -5,7 +5,6 @@ import { AuthHeader } from "@components/Common/AuthHeader/AuthHeader";
|
|||||||
import { Footer } from "@components/Common/Footer/Footer";
|
import { Footer } from "@components/Common/Footer/Footer";
|
||||||
import ModalLayout from "@components/Common/ModalLayout/ModalLayout";
|
import ModalLayout from "@components/Common/ModalLayout/ModalLayout";
|
||||||
import { ModalReset } from "@components/Modal/ModalReset/ModalReset";
|
import { ModalReset } from "@components/Modal/ModalReset/ModalReset";
|
||||||
import ModalResetPassword from "@components/Modal/ModalResetPassword/ModalResetPassword";
|
|
||||||
import SideBar from "@components/SideBar/SideBar";
|
import SideBar from "@components/SideBar/SideBar";
|
||||||
|
|
||||||
import arrowInfo from "assets/icons/trackerIntroInfo.svg";
|
import arrowInfo from "assets/icons/trackerIntroInfo.svg";
|
||||||
@ -34,12 +33,11 @@ export const TrackerAuth = () => {
|
|||||||
resetModal={setModalReset}
|
resetModal={setModalReset}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<ModalResetPassword active={modalResetOpen} setActive={setModalReset} />
|
{modalResetOpen && (
|
||||||
{/*{modalResetOpen && (*/}
|
<ModalLayout active={modalResetOpen} setActive={setModalReset}>
|
||||||
{/* <ModalLayout active={modalResetOpen} setActive={setModalReset}>*/}
|
<ModalReset setModalReset={setModalReset} />
|
||||||
{/* <ModalReset setModalReset={setModalReset} />*/}
|
</ModalLayout>
|
||||||
{/* </ModalLayout>*/}
|
)}
|
||||||
{/*)}*/}
|
|
||||||
</div>
|
</div>
|
||||||
<Footer />
|
<Footer />
|
||||||
</div>
|
</div>
|
||||||
|
@ -5,9 +5,7 @@ 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";
|
||||||
@ -20,8 +18,6 @@ import "./trackerRegistration.scss";
|
|||||||
|
|
||||||
export const TrackerRegistration = () => {
|
export const TrackerRegistration = () => {
|
||||||
const [modalConfirmOpen, setModalConfirm] = useState(false);
|
const [modalConfirmOpen, setModalConfirm] = useState(false);
|
||||||
const [loader, setLoader] = useState(false);
|
|
||||||
const [isPartner, setIsPartner] = useState(false);
|
|
||||||
const fields = {
|
const fields = {
|
||||||
username: "",
|
username: "",
|
||||||
email: "",
|
email: "",
|
||||||
@ -32,10 +28,10 @@ export const TrackerRegistration = () => {
|
|||||||
const apiEndpoint = "/register/sign-up";
|
const apiEndpoint = "/register/sign-up";
|
||||||
|
|
||||||
const { showNotification } = useNotification();
|
const { showNotification } = useNotification();
|
||||||
const showNotificationError = (error) => {
|
const showNotificationError = () => {
|
||||||
showNotification({
|
showNotification({
|
||||||
show: true,
|
show: true,
|
||||||
text: error,
|
text: "Аккаунт с таким логином или email уже существует",
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -52,10 +48,9 @@ export const TrackerRegistration = () => {
|
|||||||
apiEndpoint,
|
apiEndpoint,
|
||||||
fields,
|
fields,
|
||||||
showNotificationError,
|
showNotificationError,
|
||||||
showNotificationTrue,
|
showNotificationTrue
|
||||||
isPartner,
|
|
||||||
setLoader
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="tracker-registration">
|
<div className="tracker-registration">
|
||||||
<AuthHeader />
|
<AuthHeader />
|
||||||
@ -120,19 +115,17 @@ export const TrackerRegistration = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="tracker-registration__form__submit">
|
<div className="tracker-registration__form__submit">
|
||||||
{loader ? (
|
<button
|
||||||
<Loader />
|
onClick={async (e) => {
|
||||||
) : (
|
e.preventDefault();
|
||||||
<BaseButton
|
const result = await handleSubmit(e);
|
||||||
onClick={async (e) => {
|
if (result === true) {
|
||||||
e.preventDefault();
|
setModalConfirm(true);
|
||||||
await handleSubmit(e);
|
}
|
||||||
}}
|
}}
|
||||||
styles="button-box__submit"
|
>
|
||||||
>
|
Отправить
|
||||||
Отправить
|
</button>
|
||||||
</BaseButton>
|
|
||||||
)}
|
|
||||||
<div className="tracker-registration__form__info">
|
<div className="tracker-registration__form__info">
|
||||||
<img src={authImg} alt="img" />
|
<img src={authImg} alt="img" />
|
||||||
<p>
|
<p>
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border: none;
|
border: none;
|
||||||
max-width: 170px;
|
margin-right: 165px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1000px) {
|
@media (max-width: 1000px) {
|
||||||
@ -68,15 +68,10 @@
|
|||||||
align-items: start;
|
align-items: start;
|
||||||
row-gap: 35px;
|
row-gap: 35px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loader {
|
|
||||||
max-width: 170px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&__info {
|
&__info {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-left: 165px;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
img {
|
img {
|
||||||
margin-right: 31px;
|
margin-right: 31px;
|
||||||
|
Loading…
Reference in New Issue
Block a user