From 8e1fe15a249a2872a74f112633a3e68aabf4d6f9 Mon Sep 17 00:00:00 2001 From: Joao Ramos Date: Wed, 6 Mar 2024 11:38:08 +0000 Subject: [PATCH] Fixed loading blocking the paypal box --- src/components/PayPalPayment.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/PayPalPayment.tsx b/src/components/PayPalPayment.tsx index 6324e9d3..f009298b 100644 --- a/src/components/PayPalPayment.tsx +++ b/src/components/PayPalPayment.tsx @@ -55,7 +55,14 @@ export default function PayPalPayment({ trackingId, }) .then((response) => response.data) - .then((data) => data.id); + .then((data) => { + setIsLoading(false); + return data.id; + }) + .catch((err) => { + setIsLoading(false); + return err; + }); }; const onApprove = async (data: OnApproveData, actions: OnApproveActions) => {