registration
This commit is contained in:
parent
1e9ee3699d
commit
321b84a80e
@ -26,6 +26,14 @@ export const ModalRegistration = ({ active, setActive }) => {
|
||||
|
||||
// возвращаем true, если email проходит проверку, и false, если нет
|
||||
return re.test(email);
|
||||
};
|
||||
|
||||
const resetInputsValue = () => {
|
||||
setInputsValue({
|
||||
userName: "",
|
||||
email: "",
|
||||
password: "",
|
||||
})
|
||||
}
|
||||
|
||||
const { showNotification } = useNotification();
|
||||
@ -39,6 +47,7 @@ export const ModalRegistration = ({ active, setActive }) => {
|
||||
},
|
||||
}).then(() => {
|
||||
setActive(false);
|
||||
resetInputsValue()
|
||||
showNotification({
|
||||
show: true,
|
||||
text: "Аккаунт успешно создан",
|
||||
@ -105,7 +114,9 @@ export const ModalRegistration = ({ active, setActive }) => {
|
||||
submitHandler();
|
||||
}}
|
||||
styles={
|
||||
inputsValue.userName && validateEmail(inputsValue.email) && inputsValue.password
|
||||
inputsValue.userName &&
|
||||
validateEmail(inputsValue.email) &&
|
||||
inputsValue.password
|
||||
? "button-box__submit"
|
||||
: "button-box__submit disable"
|
||||
}
|
||||
|
@ -73,8 +73,11 @@ export const Navigation = () => {
|
||||
if (localStorage.getItem("role_status") === "18") {
|
||||
return;
|
||||
}
|
||||
if (Object.keys(profileInfo).length) {
|
||||
return;
|
||||
}
|
||||
apiRequest(`/user/me`).then((profileInfo) =>
|
||||
dispatch(setProfileInfo(profileInfo.userCard))
|
||||
dispatch(setProfileInfo(profileInfo.userCard ? profileInfo.userCard : profileInfo))
|
||||
);
|
||||
}, [dispatch]);
|
||||
|
||||
@ -93,12 +96,12 @@ export const Navigation = () => {
|
||||
|
||||
<div className="profileHeader__personalInfo">
|
||||
<h3 className="profileHeader__personalInfoName">
|
||||
{user === "developer" ? profileInfo?.fio : ""}
|
||||
{profileInfo?.fio ? profileInfo?.fio : profileInfo?.username}
|
||||
</h3>
|
||||
<NavLink end to={"/profile"}>
|
||||
<img
|
||||
src={
|
||||
profileInfo.photo ? urlForLocal(profileInfo.photo) : avatarMok
|
||||
profileInfo?.photo ? urlForLocal(profileInfo.photo) : avatarMok
|
||||
}
|
||||
className="profileHeader__personalInfoAvatar"
|
||||
alt="avatar"
|
||||
|
@ -23,6 +23,7 @@ import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadc
|
||||
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
|
||||
|
||||
import { ProfileCalendarComponent } from "./ProfileCalendarComponent";
|
||||
import avatarMok from "assets/images/avatarMok.png";
|
||||
import "./profileCalendar.scss";
|
||||
|
||||
export const ProfileCalendar = () => {
|
||||
@ -94,12 +95,14 @@ export const ProfileCalendar = () => {
|
||||
<div className="summary__info">
|
||||
<div className="summary__person">
|
||||
<img
|
||||
src={urlForLocal(profileInfo.photo)}
|
||||
src={
|
||||
profileInfo?.photo ? urlForLocal(profileInfo.photo) : avatarMok
|
||||
}
|
||||
className="summary__avatar"
|
||||
alt="avatar"
|
||||
/>
|
||||
<p className="summary__name">
|
||||
{profileInfo.fio}, {profileInfo.specification} разработчик
|
||||
{profileInfo?.fio ? profileInfo?.fio : profileInfo?.username}, {profileInfo.specification} разработчик
|
||||
</p>
|
||||
</div>
|
||||
<Link to="/report">
|
||||
|
@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { NavLink, useNavigate } from "react-router-dom";
|
||||
|
||||
import { auth, setProfileInfo } from "@redux/outstaffingSlice";
|
||||
import {auth, getProfileInfo, setProfileInfo} from "@redux/outstaffingSlice";
|
||||
import { getRole } from "@redux/roleSlice";
|
||||
|
||||
import { apiRequest } from "@api/request";
|
||||
@ -14,7 +14,7 @@ import "./profileHeader.scss";
|
||||
export const ProfileHeader = () => {
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const profileInfo = useSelector(getProfileInfo);
|
||||
const userRole = useSelector(getRole);
|
||||
const [user] = useState(
|
||||
localStorage.getItem("role_status") === "18" ? "partner" : "developer"
|
||||
@ -26,8 +26,11 @@ export const ProfileHeader = () => {
|
||||
if (localStorage.getItem("role_status") === "18") {
|
||||
return;
|
||||
}
|
||||
if (Object.keys(profileInfo).length) {
|
||||
return;
|
||||
}
|
||||
apiRequest(`/user/me`).then((profileInfo) => {
|
||||
dispatch(setProfileInfo(profileInfo.userCard));
|
||||
dispatch(setProfileInfo(profileInfo.userCard ? profileInfo.userCard : profileInfo))
|
||||
});
|
||||
}, [dispatch]);
|
||||
|
||||
|
@ -103,7 +103,7 @@ export const Profile = () => {
|
||||
{user === "developer" ? (
|
||||
<span>
|
||||
<p>Добрый день, </p>
|
||||
{profileInfo.fio}
|
||||
{profileInfo?.fio ? profileInfo?.fio : profileInfo?.username}
|
||||
</span>
|
||||
) : (
|
||||
"ООО НДВ Консалтинг"
|
||||
@ -113,7 +113,7 @@ export const Profile = () => {
|
||||
<div className="summary__person">
|
||||
<img
|
||||
src={
|
||||
profileInfo.photo ? urlForLocal(profileInfo.photo) : avatarMok
|
||||
profileInfo?.photo ? urlForLocal(profileInfo.photo) : avatarMok
|
||||
}
|
||||
className="summary__avatar"
|
||||
alt="avatar"
|
||||
@ -121,7 +121,7 @@ export const Profile = () => {
|
||||
<p className="summary__name">
|
||||
{user === "developer" ? (
|
||||
<span>
|
||||
{profileInfo.fio}, {profileInfo.specification} разработчик
|
||||
{profileInfo?.fio ? profileInfo?.fio : profileInfo?.username}, {profileInfo?.specification} разработчик
|
||||
</span>
|
||||
) : (
|
||||
"ООО НДВ Консалтинг"
|
||||
|
@ -18,6 +18,7 @@ import arrow from "assets/icons/arrows/left-arrow.png";
|
||||
import gitImgItem from "assets/icons/gitItemImg.svg";
|
||||
|
||||
import "./summary.scss";
|
||||
import avatarMok from "assets/images/avatarMok.png";
|
||||
|
||||
export const Summary = () => {
|
||||
if (localStorage.getItem("role_status") === "18") {
|
||||
@ -56,12 +57,14 @@ export const Summary = () => {
|
||||
<div className={openGit ? "summary__info openGit" : "summary__info"}>
|
||||
<div className="summary__person">
|
||||
<img
|
||||
src={urlForLocal(profileInfo.photo)}
|
||||
src={
|
||||
profileInfo?.photo ? urlForLocal(profileInfo.photo) : avatarMok
|
||||
}
|
||||
className="summary__avatar"
|
||||
alt="avatar"
|
||||
/>
|
||||
<p className="summary__name">
|
||||
{profileInfo.fio}, {profileInfo.specification} разработчик
|
||||
{profileInfo?.fio ? profileInfo?.fio : profileInfo?.username}, {profileInfo.specification} разработчик
|
||||
</p>
|
||||
</div>
|
||||
{!openGit && (
|
||||
|
Loading…
Reference in New Issue
Block a user