diff --git a/src/pages/workspace/WorkspaceMoreFeaturesPage.tsx b/src/pages/workspace/WorkspaceMoreFeaturesPage.tsx index 77b8c7b97f56..4c0f722a1737 100644 --- a/src/pages/workspace/WorkspaceMoreFeaturesPage.tsx +++ b/src/pages/workspace/WorkspaceMoreFeaturesPage.tsx @@ -12,12 +12,13 @@ import useNetwork from '@hooks/useNetwork'; import usePermissions from '@hooks/usePermissions'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; +import * as ErrorUtils from '@libs/ErrorUtils'; import type {WorkspacesCentralPaneNavigatorParamList} from '@libs/Navigation/types'; import * as Policy from '@userActions/Policy'; import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; import type SCREENS from '@src/SCREENS'; -import type {PendingAction} from '@src/types/onyx/OnyxCommon'; +import type {Errors, PendingAction} from '@src/types/onyx/OnyxCommon'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import type IconAsset from '@src/types/utils/IconAsset'; import AccessOrNotFoundWrapper from './AccessOrNotFoundWrapper'; @@ -35,6 +36,8 @@ type Item = { disabled?: boolean; action: (isEnabled: boolean) => void; pendingAction: PendingAction | undefined; + errors?: Errors; + onCloseError?: () => void; }; type SectionObject = { @@ -120,6 +123,8 @@ function WorkspaceMoreFeaturesPage({policy, route}: WorkspaceMoreFeaturesPagePro action: (isEnabled: boolean) => { Policy.enablePolicyConnections(policy?.id ?? '', isEnabled); }, + errors: ErrorUtils.getLatestErrorField(policy ?? {}, CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED), + onCloseError: () => Policy.clearPolicyErrorField(policy?.id ?? '', CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED), }, ]; @@ -158,6 +163,8 @@ function WorkspaceMoreFeaturesPage({policy, route}: WorkspaceMoreFeaturesPagePro pendingAction={item.pendingAction} onToggle={item.action} disabled={item.disabled} + errors={item.errors} + onCloseError={item.onCloseError} /> ),