diff --git a/src/components/Modal/ModalRegistration/ModalRegistration.jsx b/src/components/Modal/ModalRegistration/ModalRegistration.jsx index fe4926e1..bbe925d3 100644 --- a/src/components/Modal/ModalRegistration/ModalRegistration.jsx +++ b/src/components/Modal/ModalRegistration/ModalRegistration.jsx @@ -2,6 +2,8 @@ import React, { useState } from "react"; import { apiRequest } from "@api/request"; +import { useNotification } from "@hooks/useNotification"; + import BaseButton from "@components/Common/BaseButton/BaseButton"; import ModalLayout from "@components/Common/ModalLayout/ModalLayout"; @@ -18,6 +20,23 @@ export const ModalRegistration = ({ active, setActive }) => { password: "", }); + const validateEmail = (email) => { + // регулярное выражение для проверки email + const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; + + // возвращаем true, если email проходит проверку, и false, если нет + return re.test(email); + }; + + const resetInputsValue = () => { + setInputsValue({ + userName: "", + email: "", + password: "", + }); + }; + + const { showNotification } = useNotification(); const submitHandler = () => { apiRequest("/register/sign-up", { method: "POST", @@ -26,8 +45,14 @@ export const ModalRegistration = ({ active, setActive }) => { email: inputsValue.email, password: inputsValue.password, }, - }).then((data) => { - console.log(data); + }).then(() => { + setActive(false); + resetInputsValue(); + showNotification({ + show: true, + text: "Аккаунт успешно создан", + type: "success", + }); }); }; return ( @@ -84,9 +109,14 @@ export const ModalRegistration = ({ active, setActive }) => {
- {profileInfo.fio}, {profileInfo.specification} разработчик + {profileInfo?.fio ? profileInfo?.fio : profileInfo?.username},{" "} + {profileInfo.specification} разработчик
Добрый день,
- {profileInfo.fio} + {profileInfo?.fio ? profileInfo?.fio : profileInfo?.username} ) : ( "ООО НДВ Консалтинг" @@ -113,7 +113,7 @@ export const Profile = () => {{user === "developer" ? ( - {profileInfo.fio}, {profileInfo.specification} разработчик + {profileInfo?.fio ? profileInfo?.fio : profileInfo?.username},{" "} + {profileInfo?.specification} разработчик ) : ( "ООО НДВ Консалтинг" diff --git a/src/pages/Summary/Summary.js b/src/pages/Summary/Summary.js index 5e00d31d..8027eedb 100644 --- a/src/pages/Summary/Summary.js +++ b/src/pages/Summary/Summary.js @@ -16,6 +16,7 @@ import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader"; import rightArrow from "assets/icons/arrows/arrowRight.svg"; import arrow from "assets/icons/arrows/left-arrow.png"; import gitImgItem from "assets/icons/gitItemImg.svg"; +import avatarMok from "assets/images/avatarMok.png"; import "./summary.scss"; @@ -56,12 +57,17 @@ export const Summary = () => {
- {profileInfo.fio}, {profileInfo.specification} разработчик + {profileInfo?.fio ? profileInfo?.fio : profileInfo?.username},{" "} + {profileInfo.specification} разработчик