Compare commits
No commits in common. "ce6c2d965ae189b73ff45ed038e178a46b83efdf" and "5e7c9dec79d72677561c3d9418bd5c82c09e52ad" have entirely different histories.
ce6c2d965a
...
5e7c9dec79
@ -1,8 +1,5 @@
|
||||
import { store } from "@store/store";
|
||||
import axios from "axios";
|
||||
|
||||
import { setProfileInfo } from "@redux/outstaffingSlice";
|
||||
|
||||
import { getToken, urlHasParams } from "@utils/helper";
|
||||
|
||||
const instance = axios.create({
|
||||
@ -42,7 +39,6 @@ export const apiRequest = (
|
||||
window.location.replace("/auth");
|
||||
localStorage.clear();
|
||||
// dispatch(auth(false));
|
||||
store.dispatch(setProfileInfo({}));
|
||||
}
|
||||
return resolve(response);
|
||||
})
|
||||
|
@ -2,10 +2,12 @@ import React, { useEffect, useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { NavLink } from "react-router-dom";
|
||||
|
||||
import { getProfileInfo } from "@redux/outstaffingSlice";
|
||||
import { getProfileInfo, setProfileInfo } from "@redux/outstaffingSlice";
|
||||
|
||||
import { urlForLocal } from "@utils/helper";
|
||||
|
||||
import { apiRequest } from "@api/request";
|
||||
|
||||
import avatarMok from "assets/images/avatarMok.png";
|
||||
|
||||
export const Navigation = () => {
|
||||
@ -75,17 +77,17 @@ 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 ? profileInfo.userCard : profileInfo
|
||||
// )
|
||||
// )
|
||||
// );
|
||||
}, []);
|
||||
if (Object.keys(profileInfo).length) {
|
||||
return;
|
||||
}
|
||||
apiRequest(`/user/me`).then((profileInfo) =>
|
||||
dispatch(
|
||||
setProfileInfo(
|
||||
profileInfo.userCard ? profileInfo.userCard : profileInfo
|
||||
)
|
||||
)
|
||||
);
|
||||
}, [dispatch]);
|
||||
|
||||
return (
|
||||
<div className="profileHeader__info">
|
||||
|
@ -273,15 +273,15 @@ export const ProfileCalendarComponent = React.memo(
|
||||
? `${getCorrectDate(startDate)} - ${getCorrectDate(endDate)}`
|
||||
: `${getCorrectDate(endDate)} - ${getCorrectDate(startDate)}`
|
||||
: activePeriod
|
||||
? "Выберите диапазон на календаре"
|
||||
: "Выбрать диапазон"}
|
||||
? "Выберите диапазон на календаре"
|
||||
: "Выбрать диапазон"}
|
||||
</span>
|
||||
<span>
|
||||
{totalRangeHours
|
||||
? `${totalRangeHours} ${hourOfNum(totalRangeHours)}`
|
||||
: endDate
|
||||
? "0 часов"
|
||||
: ""}
|
||||
? "0 часов"
|
||||
: ""}
|
||||
</span>
|
||||
{endDate && (
|
||||
<BaseButton
|
||||
|
@ -20,28 +20,27 @@ export const ProfileHeader = () => {
|
||||
|
||||
const [isLoggingOut, setIsLoggingOut] = useState(false);
|
||||
|
||||
// useEffect(() => {
|
||||
// if (Object.keys(profileInfo).length) {
|
||||
// return;
|
||||
// }
|
||||
// apiRequest(`/user/me`).then((profileInfo) => {
|
||||
// dispatch(
|
||||
// setProfileInfo(
|
||||
// profileInfo.userCard ? profileInfo.userCard : profileInfo
|
||||
// )
|
||||
// );
|
||||
// });
|
||||
// }, [dispatch]);
|
||||
useEffect(() => {
|
||||
if (Object.keys(profileInfo).length) {
|
||||
return;
|
||||
}
|
||||
apiRequest(`/user/me`).then((profileInfo) => {
|
||||
dispatch(
|
||||
setProfileInfo(
|
||||
profileInfo.userCard ? profileInfo.userCard : profileInfo
|
||||
)
|
||||
);
|
||||
});
|
||||
}, [dispatch]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!Object.keys(profileInfo).length)
|
||||
apiRequest(`/user/me`).then((profileInfo) => {
|
||||
dispatch(
|
||||
setProfileInfo(
|
||||
profileInfo.userCard ? profileInfo.userCard : profileInfo
|
||||
)
|
||||
);
|
||||
});
|
||||
apiRequest(`/user/me`).then((profileInfo) => {
|
||||
dispatch(
|
||||
setProfileInfo(
|
||||
profileInfo.userCard ? profileInfo.userCard : profileInfo
|
||||
)
|
||||
);
|
||||
});
|
||||
}, []);
|
||||
|
||||
const handler = () => {
|
||||
@ -50,7 +49,6 @@ export const ProfileHeader = () => {
|
||||
dispatch(auth(false));
|
||||
setIsLoggingOut(false);
|
||||
navigate("/auth");
|
||||
dispatch(setProfileInfo({}));
|
||||
};
|
||||
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user