TP-66615 | Role check added
This commit is contained in:
@@ -22,6 +22,7 @@ import { GLOBAL } from '@constants/Global';
|
||||
import AgentIdCardFlow from '@screens/AgentIdCard';
|
||||
import { IdCardBlockStatus } from '@reducers/profileSlice';
|
||||
import FullScreenLoader from '@rn-ui-lib/components/FullScreenLoader';
|
||||
import { IUserRole } from '@reducers/userSlice';
|
||||
|
||||
interface IBlockerScreen {
|
||||
children?: ReactNode;
|
||||
@@ -40,6 +41,9 @@ const BlockerScreen = (props: IBlockerScreen) => {
|
||||
const { isWifiOrCellularOn, appState } = useAppSelector((state) => state.metadata);
|
||||
const approvalStatus = useAppSelector((state) => state.profile?.approvalStatus);
|
||||
const isLoading = useAppSelector((state) => state.profile?.isLoading);
|
||||
const roles = useAppSelector((state) => state.user?.agentRoles);
|
||||
const isFieldAgent = roles?.length === 1 && roles.includes(IUserRole.ROLE_FIELD_AGENT) || roles.includes(IUserRole.ROLE_OMA);
|
||||
|
||||
const [shouldUpdate, setShouldUpdate] = useState<boolean>();
|
||||
|
||||
const [showActionBtnLoader, setShowActionBtnLoader] = useState(false);
|
||||
@@ -219,7 +223,7 @@ const BlockerScreen = (props: IBlockerScreen) => {
|
||||
});
|
||||
return <BlockerScreenApps blacklistedAppsInstalled={blacklistedAppsInstalled} />;
|
||||
}
|
||||
if (IdCardBlockStatus[approvalStatus as keyof typeof IdCardBlockStatus]) {
|
||||
if (IdCardBlockStatus[approvalStatus as keyof typeof IdCardBlockStatus] && isFieldAgent) {
|
||||
return (
|
||||
<>
|
||||
<FullScreenLoader loading={isLoading} />
|
||||
|
||||
@@ -15,6 +15,7 @@ export enum IUserRole {
|
||||
ROLE_NAVI_FIELD_TEAM_LEAD = 'ROLE_NAVI_FIELD_TEAM_LEAD',
|
||||
ROLE_NAVI_FIELD_EXTERNAL_TEAM_LEAD = 'ROLE_NAVI_FIELD_EXTERNAL_TEAM_LEAD',
|
||||
ROLE_FIELD_AGENT = 'ROLE_FIELD_AGENT',
|
||||
ROLE_OMA = 'ROLE_OMA'
|
||||
}
|
||||
|
||||
export const MY_CASE_ITEM = {
|
||||
|
||||
Reference in New Issue
Block a user