From 5a26fea37a728a893976f07f08902e92a3add7f9 Mon Sep 17 00:00:00 2001 From: Ayobami Date: Sun, 6 Jul 2025 13:16:21 +0100 Subject: [PATCH] Fix: issue 2 modal closing if theres an error --- src/components/Billing/AddCardMethodModal.jsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/Billing/AddCardMethodModal.jsx b/src/components/Billing/AddCardMethodModal.jsx index bb173e2..182a706 100644 --- a/src/components/Billing/AddCardMethodModal.jsx +++ b/src/components/Billing/AddCardMethodModal.jsx @@ -46,6 +46,8 @@ export default function AddCardMethodModal({ setError( r.error?.message ? r.error?.message : r?.trace?.raw?.message ); + setLoading(false); + return; } else { await sdk.createCustomerStripeCard( { sourceToken: r ? r.token.id : result.token.id }, @@ -74,7 +76,11 @@ export default function AddCardMethodModal({ return ( - + {} : closeModal} + > { + setError(""); + closeModal(); + }} disabled={loading} > Cancel