From 0a9e1d1c6f77191d3b3336d0c3090999adafd195 Mon Sep 17 00:00:00 2001 From: r41ph Date: Wed, 13 Nov 2024 15:52:36 +0000 Subject: [PATCH] fix: set retiring to true when payment is card --- web-marketplace/src/pages/BuyCredits/BuyCredits.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web-marketplace/src/pages/BuyCredits/BuyCredits.tsx b/web-marketplace/src/pages/BuyCredits/BuyCredits.tsx index a97d01921d..048feb8ad7 100644 --- a/web-marketplace/src/pages/BuyCredits/BuyCredits.tsx +++ b/web-marketplace/src/pages/BuyCredits/BuyCredits.tsx @@ -11,6 +11,7 @@ import { useGetProject } from 'components/templates/ProjectDetails/hooks/useGetP import { useNavigateToSlug } from 'components/templates/ProjectDetails/hooks/useNavigateToSlug'; import { paymentOptionAtom } from './BuyCredits.atoms'; +import { PAYMENT_OPTIONS } from './BuyCredits.constants'; import { BuyCreditsForm } from './BuyCredits.Form'; import { CardDetails } from './BuyCredits.types'; import { getFormModel } from './BuyCredits.utils'; @@ -77,6 +78,12 @@ export const BuyCredits = () => { if (confirmationTokenId) summarizePayment(confirmationTokenId); }, [confirmationTokenId, summarizePayment]); + useEffect(() => { + if (!retiring && paymentOption === PAYMENT_OPTIONS.CARD) { + setRetiring(true); + } + }, [paymentOption, retiring, setRetiring]); + if (noProjectFound) return ; return (