Skip to content

Commit

Permalink
fix: close modal on back to step 0 and sync localStorage activeStep
Browse files Browse the repository at this point in the history
  • Loading branch information
r41ph committed Jan 20, 2025
1 parent 265179b commit cce9295
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions web-marketplace/src/pages/BuyCredits/BuyCredits.Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,13 @@ export const BuyCreditsForm = ({
// web3 account connected
handleSave(
{ ...data, paymentOption: PAYMENT_OPTIONS.CRYPTO },
activeStep,
0,
);
setWarningModalState({
...warningModalState,
openModal: false,
});
window.scrollTo(0, 0);
handleActiveStep(0);
}
} else if (action) {
Expand All @@ -592,12 +597,15 @@ export const BuyCreditsForm = ({
});
// After a purchase attempt where there's partial credits availability,
// we need to update the form with the new credits, currency amount and sell orders.
handleSaveNext({
...data,
[CREDITS_AMOUNT]: warningModalState.creditsAvailable,
[CURRENCY_AMOUNT]: amounts.currencyAmount,
[SELL_ORDERS]: amounts.sellOrders,
});
handleSave(
{
...data,
[CREDITS_AMOUNT]: warningModalState.creditsAvailable,
[CURRENCY_AMOUNT]: amounts.currencyAmount,
[SELL_ORDERS]: amounts.sellOrders,
},
0,
);
window.scrollTo(0, 0);
handleActiveStep(0);
}
Expand Down

0 comments on commit cce9295

Please sign in to comment.