Compare commits

..

No commits in common. "8797ba07783a1d118abf2c9e9fc5a32de70ccc8f" and "012ef7d4b634e67b26e36fd7cc20fbef3cdc21b7" have entirely different histories.

6 changed files with 36 additions and 55 deletions

View File

@ -32,10 +32,10 @@ export const ModalRegistration = ({ active, setActive }) => {
const apiEndpoint = "/register/sign-up";
const { showNotification } = useNotification();
const showNotificationError = (error) => {
const showNotificationError = () => {
showNotification({
show: true,
text: error,
text: "Аккаунт с таким логином или email уже существует",
type: "error"
});
};
@ -58,9 +58,7 @@ export const ModalRegistration = ({ active, setActive }) => {
fields,
showNotificationError,
showNotificationTrue,
isPartner,
setLoader,
closeModal
isPartner
);
return (
@ -144,7 +142,12 @@ export const ModalRegistration = ({ active, setActive }) => {
<BaseButton
onClick={async (e) => {
e.preventDefault();
await handleSubmit(e);
setLoader(true);
const result = await handleSubmit(e);
if (result === true) {
closeModal();
}
setLoader(false);
}}
styles="button-box__submit"
>

View File

@ -249,5 +249,6 @@
.loader {
justify-content: start;
left: 80px;
}
}

View File

@ -7,9 +7,7 @@ export const useFormValidation = (
fields,
showNotificationError,
showNotificationTrue,
isPartner,
setLoader,
closeModal
isPartner
) => {
// Состояние формы, содержащее значения полей
const [formData, setFormData] = useState(fields);
@ -87,7 +85,6 @@ export const useFormValidation = (
e.preventDefault();
// Проверка валидации формы
if (validateForm()) {
setLoader(true);
let newformData = { ...formData, is_partner: isPartner ? 1 : 0 };
delete newformData.secondPassword;
@ -96,18 +93,12 @@ export const useFormValidation = (
method: "POST",
data: newformData
}).then((data) => {
setLoader(false);
if ("errors" in data) {
return showNotificationError(
"Аккаунт с таким логином или email уже существуе"
);
}
if (!data.id) {
return showNotificationError("Ошибка");
}
showNotificationError();
} else {
handleClearForm();
showNotificationTrue();
closeModal();
}
});
} catch (error) {
console.error("Error submitting form:", error);

View File

@ -5,7 +5,6 @@ import { AuthHeader } from "@components/Common/AuthHeader/AuthHeader";
import { Footer } from "@components/Common/Footer/Footer";
import ModalLayout from "@components/Common/ModalLayout/ModalLayout";
import { ModalReset } from "@components/Modal/ModalReset/ModalReset";
import ModalResetPassword from "@components/Modal/ModalResetPassword/ModalResetPassword";
import SideBar from "@components/SideBar/SideBar";
import arrowInfo from "assets/icons/trackerIntroInfo.svg";
@ -34,12 +33,11 @@ export const TrackerAuth = () => {
resetModal={setModalReset}
/>
</div>
<ModalResetPassword active={modalResetOpen} setActive={setModalReset} />
{/*{modalResetOpen && (*/}
{/* <ModalLayout active={modalResetOpen} setActive={setModalReset}>*/}
{/* <ModalReset setModalReset={setModalReset} />*/}
{/* </ModalLayout>*/}
{/*)}*/}
{modalResetOpen && (
<ModalLayout active={modalResetOpen} setActive={setModalReset}>
<ModalReset setModalReset={setModalReset} />
</ModalLayout>
)}
</div>
<Footer />
</div>

View File

@ -5,9 +5,7 @@ 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";
@ -20,8 +18,6 @@ import "./trackerRegistration.scss";
export const TrackerRegistration = () => {
const [modalConfirmOpen, setModalConfirm] = useState(false);
const [loader, setLoader] = useState(false);
const [isPartner, setIsPartner] = useState(false);
const fields = {
username: "",
email: "",
@ -32,10 +28,10 @@ export const TrackerRegistration = () => {
const apiEndpoint = "/register/sign-up";
const { showNotification } = useNotification();
const showNotificationError = (error) => {
const showNotificationError = () => {
showNotification({
show: true,
text: error,
text: "Аккаунт с таким логином или email уже существует",
type: "error"
});
};
@ -52,10 +48,9 @@ export const TrackerRegistration = () => {
apiEndpoint,
fields,
showNotificationError,
showNotificationTrue,
isPartner,
setLoader
showNotificationTrue
);
return (
<div className="tracker-registration">
<AuthHeader />
@ -120,19 +115,17 @@ export const TrackerRegistration = () => {
</div>
</div>
<div className="tracker-registration__form__submit">
{loader ? (
<Loader />
) : (
<BaseButton
<button
onClick={async (e) => {
e.preventDefault();
await handleSubmit(e);
const result = await handleSubmit(e);
if (result === true) {
setModalConfirm(true);
}
}}
styles="button-box__submit"
>
Отправить
</BaseButton>
)}
</button>
<div className="tracker-registration__form__info">
<img src={authImg} alt="img" />
<p>

View File

@ -56,7 +56,7 @@
font-size: 18px;
color: #fff;
border: none;
max-width: 170px;
margin-right: 165px;
}
@media (max-width: 1000px) {
@ -68,15 +68,10 @@
align-items: start;
row-gap: 35px;
}
.loader {
max-width: 170px;
}
}
&__info {
display: flex;
margin-left: 165px;
align-items: center;
img {
margin-right: 31px;