Skip to content

Commit 45e23ea

Browse files
committed
fix: remove the redundant check for 401
1 parent d039352 commit 45e23ea

File tree

7 files changed

+26
-34
lines changed

7 files changed

+26
-34
lines changed

src/Pages/GlobalConfigurations/Authorization/PermissionGroups/AddEdit/PermissionGroupAddEdit.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const PermissionGroupAddEdit = () => {
4545
/>
4646
)
4747
}
48-
if ([API_STATUS_CODES.PERMISSION_DENIED, API_STATUS_CODES.UNAUTHORIZED].includes(error.code)) {
48+
if (error.code === API_STATUS_CODES.PERMISSION_DENIED) {
4949
return (
5050
<ErrorScreenNotAuthorized
5151
subtitle={ERROR_EMPTY_SCREEN.REQUIRED_MANAGER_ACCESS}

src/Pages/GlobalConfigurations/Authorization/PermissionGroups/List/PermissionGroupList.component.tsx

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback, useMemo, useRef } from 'react'
1+
import React, { useMemo, useRef } from 'react'
22
import {
33
SortingOrder,
44
SortableTableHeaderCell,
@@ -63,22 +63,19 @@ const PermissionGroupList = () => {
6363

6464
const showLoadingState = isLoading || getIsRequestAborted(error)
6565

66-
const getPermissionGroupDataForExport = useCallback(
67-
() =>
68-
getPermissionGroupList({
69-
...filterConfig,
70-
showAll: true,
71-
offset: null,
72-
size: null,
73-
sortBy: SortableKeys.name,
74-
sortOrder: SortingOrder.ASC,
75-
}),
76-
[filterConfig],
77-
)
66+
const getPermissionGroupDataForExport = () =>
67+
getPermissionGroupList({
68+
...filterConfig,
69+
showAll: true,
70+
offset: null,
71+
size: null,
72+
sortBy: SortableKeys.name,
73+
sortOrder: SortingOrder.ASC,
74+
})
7875

7976
if (!showLoadingState) {
8077
if (error) {
81-
if ([API_STATUS_CODES.PERMISSION_DENIED, API_STATUS_CODES.UNAUTHORIZED].includes(error.code)) {
78+
if (error.code === API_STATUS_CODES.PERMISSION_DENIED) {
8279
return (
8380
<ErrorScreenNotAuthorized
8481
subtitle={ERROR_EMPTY_SCREEN.REQUIRED_MANAGER_ACCESS}

src/Pages/GlobalConfigurations/Authorization/UserAndGroupPermissions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ const UserAndGroupPermissions = () => {
205205
}
206206

207207
if (error) {
208-
if ([API_STATUS_CODES.PERMISSION_DENIED, API_STATUS_CODES.UNAUTHORIZED].includes(error.code)) {
208+
if (error.code === API_STATUS_CODES.PERMISSION_DENIED) {
209209
return (
210210
<ErrorScreenNotAuthorized
211211
subtitle={ERROR_EMPTY_SCREEN.REQUIRED_MANAGER_ACCESS}

src/Pages/GlobalConfigurations/Authorization/UserPermissions/AddEdit/UserPermissionAddEdit.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const UserPermissionAddEdit = () => {
4141
)
4242
}
4343
if (error) {
44-
if ([API_STATUS_CODES.PERMISSION_DENIED, API_STATUS_CODES.UNAUTHORIZED].includes(error.code)) {
44+
if (error.code === API_STATUS_CODES.PERMISSION_DENIED) {
4545
return (
4646
<ErrorScreenNotAuthorized
4747
subtitle={ERROR_EMPTY_SCREEN.REQUIRED_MANAGER_ACCESS}

src/Pages/GlobalConfigurations/Authorization/UserPermissions/List/UserPermissionList.component.tsx

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback, useMemo, useRef } from 'react'
1+
import React, { useMemo, useRef } from 'react'
22
import {
33
SortingOrder,
44
SortableTableHeaderCell,
@@ -63,22 +63,19 @@ const UserPermissionList = () => {
6363

6464
const showLoadingState = isLoading || getIsRequestAborted(error)
6565

66-
const getUserDataForExport = useCallback(
67-
() =>
68-
getUserList({
69-
...filterConfig,
70-
showAll: true,
71-
offset: null,
72-
size: null,
73-
sortBy: SortableKeys.email,
74-
sortOrder: SortingOrder.ASC,
75-
}),
76-
[filterConfig],
77-
)
66+
const getUserDataForExport = () =>
67+
getUserList({
68+
...filterConfig,
69+
showAll: true,
70+
offset: null,
71+
size: null,
72+
sortBy: SortableKeys.email,
73+
sortOrder: SortingOrder.ASC,
74+
})
7875

7976
if (!showLoadingState) {
8077
if (error) {
81-
if ([API_STATUS_CODES.PERMISSION_DENIED, API_STATUS_CODES.UNAUTHORIZED].includes(error.code)) {
78+
if (error.code === API_STATUS_CODES.PERMISSION_DENIED) {
8279
return (
8380
<ErrorScreenNotAuthorized
8481
subtitle={ERROR_EMPTY_SCREEN.REQUIRED_MANAGER_ACCESS}

src/Pages/GlobalConfigurations/Authorization/UserPermissions/List/UserPermissionListHeader.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ const UserPermissionListHeader = ({
5959
placeholder: 'Search User',
6060
}}
6161
handleEnter={handleSearch}
62-
shouldDebounce
63-
debounceTimeout={3000}
6462
initialSearchText={initialSearchText}
6563
/>
6664
{/* TODO (v3): Add the multi-select filtering */}

src/Pages/GlobalConfigurations/Authorization/UserPermissions/UserPermissions.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const UserPermissions = () => {
2424
}
2525

2626
if (ssoConfigError) {
27-
if ([API_STATUS_CODES.PERMISSION_DENIED, API_STATUS_CODES.UNAUTHORIZED].includes(ssoConfigError.code)) {
27+
if (ssoConfigError.code === API_STATUS_CODES.PERMISSION_DENIED) {
2828
return (
2929
<ErrorScreenNotAuthorized
3030
subtitle={ERROR_EMPTY_SCREEN.REQUIRED_MANAGER_ACCESS}

0 commit comments

Comments
 (0)