diff --git a/src/api/request.js b/src/api/request.js index b46de4cd..b1685709 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -1,9 +1,10 @@ +import { store } from "@store/store"; import axios from "axios"; -import { getToken, urlHasParams } from "@utils/helper"; -import { store } from "@store/store"; import { setProfileInfo } from "@redux/outstaffingSlice"; +import { getToken, urlHasParams } from "@utils/helper"; + const instance = axios.create({ baseURL: process.env.REACT_APP_API_URL, validateStatus(status) { @@ -41,7 +42,7 @@ export const apiRequest = ( window.location.replace("/auth"); localStorage.clear(); // dispatch(auth(false)); - store.dispatch(setProfileInfo({})) + store.dispatch(setProfileInfo({})); } return resolve(response); }) diff --git a/src/components/ProfileCalendar/ProfileCalendarComponent.jsx b/src/components/ProfileCalendar/ProfileCalendarComponent.jsx index 204d2c8b..b1f468cd 100644 --- a/src/components/ProfileCalendar/ProfileCalendarComponent.jsx +++ b/src/components/ProfileCalendar/ProfileCalendarComponent.jsx @@ -273,15 +273,15 @@ export const ProfileCalendarComponent = React.memo( ? `${getCorrectDate(startDate)} - ${getCorrectDate(endDate)}` : `${getCorrectDate(endDate)} - ${getCorrectDate(startDate)}` : activePeriod - ? "Выберите диапазон на календаре" - : "Выбрать диапазон"} + ? "Выберите диапазон на календаре" + : "Выбрать диапазон"} {totalRangeHours ? `${totalRangeHours} ${hourOfNum(totalRangeHours)}` : endDate - ? "0 часов" - : ""} + ? "0 часов" + : ""} {endDate && ( { // }, [dispatch]); useEffect(() => { - if (!Object.keys(profileInfo).length) apiRequest(`/user/me`).then((profileInfo) => { - dispatch( - setProfileInfo( - profileInfo.userCard ? profileInfo.userCard : profileInfo - ) - ); - }); + if (!Object.keys(profileInfo).length) + apiRequest(`/user/me`).then((profileInfo) => { + dispatch( + setProfileInfo( + profileInfo.userCard ? profileInfo.userCard : profileInfo + ) + ); + }); }, []); const handler = () => { @@ -49,7 +50,7 @@ export const ProfileHeader = () => { dispatch(auth(false)); setIsLoggingOut(false); navigate("/auth"); - dispatch(setProfileInfo({})) + dispatch(setProfileInfo({})); }; return (