NTP-49842 | Side NavBar Revamp Hotfix (#1426)
This commit is contained in:
@@ -7,10 +7,12 @@ import { impersonateUser } from './action';
|
||||
import { PARAMS_MAP_KEY } from '@cp/src/components/sidebar/SideNavigationPanel/utils';
|
||||
import { LONGHORN_SESSION_TOKEN } from '../auth/constants/AuthConstants';
|
||||
import { ImpersonationFormData } from './interface';
|
||||
import { useDispatch } from 'react-redux';
|
||||
|
||||
const Impersonation = () => {
|
||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const {
|
||||
control,
|
||||
@@ -35,7 +37,6 @@ const Impersonation = () => {
|
||||
if (response?.data?.accessToken) {
|
||||
localStorage.removeItem(PARAMS_MAP_KEY);
|
||||
localStorage.setItem(LONGHORN_SESSION_TOKEN, response.data.accessToken);
|
||||
navigate('/');
|
||||
window.location.reload();
|
||||
} else {
|
||||
throw new Error('Invalid access token');
|
||||
|
||||
@@ -25,7 +25,8 @@ import axiosInstance, {
|
||||
ApiKeys,
|
||||
getApiUrl,
|
||||
getErrorMessage,
|
||||
logError
|
||||
logError,
|
||||
navigate
|
||||
} from '../../utils/ApiHelper';
|
||||
import {
|
||||
resetGlobalError,
|
||||
@@ -54,10 +55,12 @@ import {
|
||||
LONGHORN_SESSION_TOKEN,
|
||||
SendOTPPayload,
|
||||
CODE_VERIFIER,
|
||||
VerifyOTPPayload
|
||||
VerifyOTPPayload,
|
||||
Roles
|
||||
} from './constants/AuthConstants';
|
||||
import { setAgencyRankingData } from '@cp/src/reducers/AgencyDetailsSlice';
|
||||
import logger from '@cp/src/utils/logger';
|
||||
import APP_ROUTES from '@cp/src/layout/Routes';
|
||||
|
||||
const defaultGuestUserMsClarityData: IMsClarityData = {
|
||||
referenceId: 'guestUser',
|
||||
@@ -241,6 +244,12 @@ export const verifyUserSession = () => {
|
||||
GLOBAL.AGENT_BUSINESS_VERTICAL = agentBusinessVertical;
|
||||
dispatch(setAgentBusinessVertical(agentBusinessVertical));
|
||||
dispatch(setAuthData(response?.data));
|
||||
if (response.data.roles?.includes(Roles.ROLE_TEAM_LEAD)) {
|
||||
navigate(APP_ROUTES.TEAM_LEAD_DASHBOARD.path);
|
||||
} else {
|
||||
navigate(APP_ROUTES.CASES.path);
|
||||
}
|
||||
|
||||
if (response?.data) {
|
||||
setMsClarityData({
|
||||
referenceId: response.data.referenceId,
|
||||
|
||||
@@ -24,11 +24,6 @@ const Login = () => {
|
||||
|
||||
const navigateToCases = async () => {
|
||||
await dispatch(verifyUserSession());
|
||||
if (!store.getState().common?.userData?.roles?.includes(Roles.ROLE_TEAM_LEAD)) {
|
||||
navigate(APP_ROUTES.CASES.path, { replace: true, state: { from: location } });
|
||||
} else {
|
||||
navigate(APP_ROUTES.TEAM_LEAD_DASHBOARD.path, { replace: true, state: { from: location } });
|
||||
}
|
||||
};
|
||||
|
||||
const getLoginContent = (): JSX.Element => {
|
||||
|
||||
@@ -688,8 +688,8 @@ MOCK_API_URLS[ApiKeys.GET_AGENCY_DETAILS_TELE_GOVERNANCE_DATA] = 'agencyDetailsT
|
||||
MOCK_API_URLS[ApiKeys.GET_AGENT_PERFORMANCE_TELE_GOVERNANCE_DATA] = 'agentPerformanceTele.json';
|
||||
MOCK_API_URLS[ApiKeys.GET_AGENT_NAME_OPTIONS] = 'agentNameOptions.json';
|
||||
MOCK_API_URLS[ApiKeys.AGENT_AVAILABILITY_HISTORY] = 'agentAvailabilityHistory.json';
|
||||
let navigate: NavigateFunction;
|
||||
let dispatch: Dispatch<any>;
|
||||
export let navigate: NavigateFunction;
|
||||
export let dispatch: Dispatch<any>;
|
||||
|
||||
export const API_STATUS_CODE = {
|
||||
OK: 200,
|
||||
|
||||
Reference in New Issue
Block a user