From bd6f6af8dedbfedc960b08350046762527c8f0ab Mon Sep 17 00:00:00 2001 From: MaxOvs19 Date: Thu, 14 Dec 2023 16:28:21 +0300 Subject: [PATCH] Fixed req in user/me for partners --- src/components/ProfileHeader/ProfileHeader.jsx | 13 ++++++++++--- src/pages/Profile/Profile.js | 9 +++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) 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} + )}