Skip to content

Commit

Permalink
fix: editing issue after coming back (#3)
Browse files Browse the repository at this point in the history
* fix: editing issue after coming back

* fix: move condition
  • Loading branch information
MrMuzyk authored Jan 19, 2024
1 parent fdc7aed commit eca2209
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/pages/ReimbursementAccount/ReimbursementAccountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,6 @@ function ReimbursementAccountPage({reimbursementAccount, route, onfidoToken, pol
}
}

// Update the data that is returned from back-end to draft value
const draftStep = reimbursementAccount.draftStep;
if (draftStep) {
BankAccounts.updateReimbursementAccountDraft(getBankAccountFields(getFieldsForStep(draftStep)));
}

/**
* Returns true if a VBBA exists in any state other than OPEN or LOCKED
* @returns {Boolean}
Expand Down Expand Up @@ -324,6 +318,13 @@ function ReimbursementAccountPage({reimbursementAccount, route, onfidoToken, pol
// The route is showing the correct step, no need to update the route param or clear errors.
return;
}

// Update the data that is returned from back-end to draft value
const draftStep = reimbursementAccount.draftStep;
if (draftStep) {
BankAccounts.updateReimbursementAccountDraft(getBankAccountFields(getFieldsForStep(draftStep)));
}

if (currentStepRouteParam !== '') {
// When we click "Connect bank account", we load the page without the current step param, if there
// was an error when we tried to disconnect or start over, we want the user to be able to see the error,
Expand Down

0 comments on commit eca2209

Please sign in to comment.