diff --git a/src/components/ProfileHeader/ProfileHeader.jsx b/src/components/ProfileHeader/ProfileHeader.jsx index 6a692b1c..adf2d327 100644 --- a/src/components/ProfileHeader/ProfileHeader.jsx +++ b/src/components/ProfileHeader/ProfileHeader.jsx @@ -21,9 +21,6 @@ export const ProfileHeader = () => { const [isLoggingOut, setIsLoggingOut] = useState(false); useEffect(() => { - if (localStorage.getItem("role_status") === "18") { - return; - } if (Object.keys(profileInfo).length) { return; } @@ -36,6 +33,16 @@ export const ProfileHeader = () => { }); }, [dispatch]); + useEffect(() => { + apiRequest(`/user/me`).then((profileInfo) => { + dispatch( + setProfileInfo( + profileInfo.userCard ? profileInfo.userCard : profileInfo + ) + ); + }); + }, []); + const handler = () => { setIsLoggingOut(true); localStorage.clear(); diff --git a/src/pages/Profile/Profile.js b/src/pages/Profile/Profile.js index 25af6d3d..c731c651 100644 --- a/src/pages/Profile/Profile.js +++ b/src/pages/Profile/Profile.js @@ -106,7 +106,10 @@ export const Profile = () => { {profileInfo?.fio ? profileInfo?.fio : profileInfo?.username} ) : ( - "ООО НДВ Консалтинг" + +

Добрый день, 

+ {profileInfo?.fio ? profileInfo?.fio : profileInfo?.username} +
)}
@@ -125,7 +128,9 @@ export const Profile = () => { {profileInfo?.specification} разработчик ) : ( - "ООО НДВ Консалтинг" + + {profileInfo?.fio ? profileInfo?.fio : profileInfo?.username} + )}