Skip to content

Commit

Permalink
Merge pull request #49327 from daledah/fix/49073
Browse files Browse the repository at this point in the history
fix: Verify button does not show loading indicator after entering magic code
  • Loading branch information
Julesssss authored Sep 23, 2024
2 parents bbc0919 + eedde25 commit 215a2e8
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/libs/actions/Card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,32 @@ function revealVirtualCardDetails(cardID: number, validateCode: string): Promise
return new Promise((resolve, reject) => {
const parameters: RevealExpensifyCardDetailsParams = {cardID, validateCode};

const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.ACCOUNT,
value: {isLoading: true},
},
];

const successData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.ACCOUNT,
value: {isLoading: false},
},
];

const failureData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.ACCOUNT,
value: {isLoading: false},
},
];

// eslint-disable-next-line rulesdir/no-api-side-effects-method
API.makeRequestWithSideEffects(SIDE_EFFECT_REQUEST_COMMANDS.REVEAL_EXPENSIFY_CARD_DETAILS, parameters)
API.makeRequestWithSideEffects(SIDE_EFFECT_REQUEST_COMMANDS.REVEAL_EXPENSIFY_CARD_DETAILS, parameters, {optimisticData, successData, failureData})
.then((response) => {
if (response?.jsonCode !== CONST.JSON_CODE.SUCCESS) {
if (response?.jsonCode === CONST.JSON_CODE.INCORRECT_MAGIC_CODE) {
Expand Down

0 comments on commit 215a2e8

Please sign in to comment.