From 6a74ddb424359ce2a4ce39c5ff1fee9b0c7fcf5b Mon Sep 17 00:00:00 2001 From: MaxOvs19 Date: Fri, 27 Oct 2023 18:32:37 +0300 Subject: [PATCH] Fixed calendar and req profile --- src/components/Navigation/Navigation.jsx | 4 ++-- src/components/ProfileCalendar/ProfileCalendarComponent.jsx | 2 ++ src/components/ProfileHeader/ProfileHeader.jsx | 6 +++--- src/pages/Tracker/Tracker.jsx | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/Navigation/Navigation.jsx b/src/components/Navigation/Navigation.jsx index fb83c23a..cbac4365 100644 --- a/src/components/Navigation/Navigation.jsx +++ b/src/components/Navigation/Navigation.jsx @@ -73,8 +73,8 @@ export const Navigation = () => { if (localStorage.getItem("role_status") === "18") { return; } - apiRequest(`/profile/${localStorage.getItem("cardId")}`).then( - (profileInfo) => dispatch(setProfileInfo(profileInfo)) + apiRequest(`/user/me`).then((profileInfo) => + dispatch(setProfileInfo(profileInfo.userCard)) ); }, [dispatch]); diff --git a/src/components/ProfileCalendar/ProfileCalendarComponent.jsx b/src/components/ProfileCalendar/ProfileCalendarComponent.jsx index 3a862508..d7d78bde 100644 --- a/src/components/ProfileCalendar/ProfileCalendarComponent.jsx +++ b/src/components/ProfileCalendar/ProfileCalendarComponent.jsx @@ -329,6 +329,8 @@ export const ProfileCalendarComponent = React.memo( styles={"clear-days"} onClick={() => { resetRangeDays(); + toggleActivePeriod(); + toggleRangeDays(); }} > Сбросить diff --git a/src/components/ProfileHeader/ProfileHeader.jsx b/src/components/ProfileHeader/ProfileHeader.jsx index eb592312..96daa0fe 100644 --- a/src/components/ProfileHeader/ProfileHeader.jsx +++ b/src/components/ProfileHeader/ProfileHeader.jsx @@ -26,9 +26,9 @@ export const ProfileHeader = () => { if (localStorage.getItem("role_status") === "18") { return; } - apiRequest(`/profile/${localStorage.getItem("cardId")}`).then( - (profileInfo) => dispatch(setProfileInfo(profileInfo)) - ); + apiRequest(`/user/me`).then((profileInfo) => { + dispatch(setProfileInfo(profileInfo.userCard)); + }); }, [dispatch]); const handler = () => { diff --git a/src/pages/Tracker/Tracker.jsx b/src/pages/Tracker/Tracker.jsx index 3020d102..6ec7ac93 100644 --- a/src/pages/Tracker/Tracker.jsx +++ b/src/pages/Tracker/Tracker.jsx @@ -129,7 +129,7 @@ export const Tracker = () => { e.target.closest("img").classList.toggle("open-desc-item"); e.target .closest("td") - .querySelector(".taskList__table__name-project") + ?.querySelector(".taskList__table__name-project") .classList.toggle("hide-desc"); }