Skip to content

Commit 10abb4b

Browse files
committed
prettier fix and ts fix
1 parent e1a6c43 commit 10abb4b

3 files changed

Lines changed: 17 additions & 14 deletions

File tree

src/libs/actions/Domain.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import Onyx from 'react-native-onyx';
22
import type {OnyxUpdate} from 'react-native-onyx';
3+
import type {ValueOf} from 'type-fest';
34
import * as API from '@libs/API';
4-
import type {AddAdminToDomainParams, RemoveDomainAdminParams, SetTechnicalContactEmailParams, SetVacationDelegateParams, ToggleConsolidatedDomainBillingParams} from '@libs/API/parameters';
5+
import type {AddAdminToDomainParams, RemoveDomainAdminParams, SetTechnicalContactEmailParams, ToggleConsolidatedDomainBillingParams} from '@libs/API/parameters';
56
import {READ_COMMANDS, SIDE_EFFECT_REQUEST_COMMANDS, WRITE_COMMANDS} from '@libs/API/types';
6-
import {getMicroSecondOnyxErrorWithTranslationKey, getMicroSecondTranslationErrorWithTranslationKey} from '@libs/ErrorUtils';
7-
import * as ErrorUtils from '@libs/ErrorUtils';
7+
import {getMicroSecondOnyxErrorWithTranslationKey} from '@libs/ErrorUtils';
88
import {getAuthToken} from '@libs/Network/NetworkStore';
99
import CONST from '@src/CONST';
1010
import ONYXKEYS from '@src/ONYXKEYS';
11-
import type * as OnyxCommon from '@src/types/onyx/OnyxCommon';
12-
import {BaseVacationDelegate} from '@src/types/onyx/VacationDelegate';
11+
import type {BaseVacationDelegate} from '@src/types/onyx/VacationDelegate';
1312
import {isEmptyObject} from '@src/types/utils/EmptyObject';
1413
import type PrefixedRecord from '@src/types/utils/PrefixedRecord';
1514
import type {ScimTokenWithState} from './ScimToken/ScimTokenUtils';
@@ -796,10 +795,14 @@ function setDomainVacationDelegate(
796795
},
797796
];
798797

799-
// Will be replaced with new api call
798+
// Will be replaced with a new api call
800799
Onyx.update(optimisticData);
801-
return new Promise((resolve) => {
802-
resolve();
800+
return new Promise<{jsonCode?: ValueOf<typeof CONST.JSON_CODE>}>((resolve) => {
801+
if (!shouldOverridePolicyDiffWarning) {
802+
resolve({jsonCode: CONST.JSON_CODE.POLICY_DIFF_WARNING});
803+
return;
804+
}
805+
resolve({jsonCode: CONST.JSON_CODE.SUCCESS});
803806
});
804807
}
805808

@@ -815,10 +818,10 @@ function deleteDomainVacationDelegate(vacationDelegate: BaseVacationDelegate, do
815818
onyxMethod: Onyx.METHOD.MERGE,
816819
key: `${ONYXKEYS.COLLECTION.DOMAIN}${domainAccountID}`,
817820
value: {
818-
[`${CONST.DOMAIN.PRIVATE_VACATION_DELEGATE_PREFIX}${domainMemberAccountID}`]: {
821+
[vacationDelegateKey]: {
819822
delegate: null,
820823
creator: null,
821-
previousDelegate: previousDelegate,
824+
previousDelegate: previousDelegate ?? null,
822825
},
823826
} as PrefixedRecord<typeof CONST.DOMAIN.PRIVATE_VACATION_DELEGATE_PREFIX, BaseVacationDelegate>,
824827
},
@@ -934,7 +937,7 @@ function clearVacationDelegateError(domainMemberAccountID: number, domainAccount
934937
creator: null,
935938
previousDelegate: null,
936939
},
937-
} as PrefixedRecord<typeof CONST.DOMAIN.PRIVATE_VACATION_DELEGATE_PREFIX, BaseVacationDelegate>,
940+
} as unknown as PrefixedRecord<typeof CONST.DOMAIN.PRIVATE_VACATION_DELEGATE_PREFIX, BaseVacationDelegate>,
938941
},
939942
];
940943

src/pages/domain/Members/DomainMemberDetailsPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ function DomainMemberDetailsPage({route}: DomainMemberDetailsPageProps) {
2929
>
3030
<VacationDelegateMenuItem
3131
vacationDelegate={vacationDelegate}
32-
errors={getLatestError(domainErrors?.vacationDelegateErrors?.[accountID])}
33-
pendingAction={domainPendingActions?.vacationDelegate?.[accountID]}
32+
errors={getLatestError(domainErrors?.memberErrors?.[accountID]?.vacationDelegateErrors)}
33+
pendingAction={domainPendingActions.member?.[accountID]?.vacationDelegate}
3434
onCloseError={() => clearVacationDelegateError(vacationDelegate?.previousDelegate, domainAccountID, accountID)}
3535
onPress={() => Navigation.navigate(ROUTES.DOMAIN_VACATION_DELEGATE.getRoute(domainAccountID, accountID))}
3636
/>

src/pages/domain/Members/DomainMemberVacationDelegatePage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import BaseVacationDelegateSelectionComponent from '@components/BaseVacationDelegateSelectionComponent';
3-
import ScreenWrapper from '@components/ScreenWrapper';
43
import {ModalActions} from '@components/Modal/Global/ModalContext';
4+
import ScreenWrapper from '@components/ScreenWrapper';
55
import useConfirmModal from '@hooks/useConfirmModal';
66
import useLocalize from '@hooks/useLocalize';
77
import useVacationDelegate from '@hooks/useVacationDelegate';

0 commit comments

Comments
 (0)