From cce92956345d100de4d6a0dd0f97b5ff9c51f01f Mon Sep 17 00:00:00 2001 From: r41ph Date: Thu, 16 Jan 2025 11:54:27 +0000 Subject: [PATCH] fix: close modal on back to step 0 and sync localStorage activeStep --- .../src/pages/BuyCredits/BuyCredits.Form.tsx | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/web-marketplace/src/pages/BuyCredits/BuyCredits.Form.tsx b/web-marketplace/src/pages/BuyCredits/BuyCredits.Form.tsx index 5cf9a796ae..423c7a140e 100644 --- a/web-marketplace/src/pages/BuyCredits/BuyCredits.Form.tsx +++ b/web-marketplace/src/pages/BuyCredits/BuyCredits.Form.tsx @@ -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) { @@ -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); }