NTP-49842 | Side NavBar Revamp Hotfix (#1426)

This commit is contained in:
Ashish Deo
2025-04-21 20:41:10 +05:30
committed by GitHub
parent 6162670478
commit e501642ed7
4 changed files with 15 additions and 10 deletions

View File

@@ -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');

View File

@@ -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,

View File

@@ -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 => {

View File

@@ -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,