registration
This commit is contained in:
@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { NavLink, useNavigate } from "react-router-dom";
|
||||
|
||||
import { auth, setProfileInfo } from "@redux/outstaffingSlice";
|
||||
import {auth, getProfileInfo, setProfileInfo} from "@redux/outstaffingSlice";
|
||||
import { getRole } from "@redux/roleSlice";
|
||||
|
||||
import { apiRequest } from "@api/request";
|
||||
@ -14,7 +14,7 @@ import "./profileHeader.scss";
|
||||
export const ProfileHeader = () => {
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const profileInfo = useSelector(getProfileInfo);
|
||||
const userRole = useSelector(getRole);
|
||||
const [user] = useState(
|
||||
localStorage.getItem("role_status") === "18" ? "partner" : "developer"
|
||||
@ -26,8 +26,11 @@ export const ProfileHeader = () => {
|
||||
if (localStorage.getItem("role_status") === "18") {
|
||||
return;
|
||||
}
|
||||
if (Object.keys(profileInfo).length) {
|
||||
return;
|
||||
}
|
||||
apiRequest(`/user/me`).then((profileInfo) => {
|
||||
dispatch(setProfileInfo(profileInfo.userCard));
|
||||
dispatch(setProfileInfo(profileInfo.userCard ? profileInfo.userCard : profileInfo))
|
||||
});
|
||||
}, [dispatch]);
|
||||
|
||||
|
Reference in New Issue
Block a user