From 98bf179b9e59871c33ed70a0397b0e510454b4d8 Mon Sep 17 00:00:00 2001 From: Mikola Date: Sat, 4 Nov 2023 02:39:58 +0300 Subject: [PATCH] registration --- .../ModalRegistration/ModalRegistration.jsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/Modal/ModalRegistration/ModalRegistration.jsx b/src/components/Modal/ModalRegistration/ModalRegistration.jsx index fe4926e1..dfa83684 100644 --- a/src/components/Modal/ModalRegistration/ModalRegistration.jsx +++ b/src/components/Modal/ModalRegistration/ModalRegistration.jsx @@ -4,6 +4,7 @@ import { apiRequest } from "@api/request"; import BaseButton from "@components/Common/BaseButton/BaseButton"; import ModalLayout from "@components/Common/ModalLayout/ModalLayout"; +import { useNotification } from "@hooks/useNotification"; import anyMoment from "assets/icons/anyMoment.svg"; import doc from "assets/icons/doc.svg"; @@ -17,7 +18,7 @@ export const ModalRegistration = ({ active, setActive }) => { email: "", password: "", }); - + const { showNotification } = useNotification(); const submitHandler = () => { apiRequest("/register/sign-up", { method: "POST", @@ -26,8 +27,13 @@ export const ModalRegistration = ({ active, setActive }) => { email: inputsValue.email, password: inputsValue.password, }, - }).then((data) => { - console.log(data); + }).then(() => { + setActive(false) + showNotification({ + show: true, + text: "Аккаунт успешно создан", + type: "success" + }); }); }; return ( @@ -84,7 +90,10 @@ export const ModalRegistration = ({ active, setActive }) => {
submitHandler()} + onClick={(e) => { + e.preventDefault() + submitHandler() + }} styles={ inputsValue.userName && inputsValue.email && inputsValue.password ? "button-box__submit"