From f300850b19f8b4084bfac88a4cfd06e43bc75a8e Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Wed, 6 Apr 2022 12:20:00 -0300
Subject: cta stories and input filled mui

---
 packages/taler-wallet-webextension/src/cta/Pay.tsx | 31 ++++++++++++----------
 1 file changed, 17 insertions(+), 14 deletions(-)

(limited to 'packages/taler-wallet-webextension/src/cta/Pay.tsx')

diff --git a/packages/taler-wallet-webextension/src/cta/Pay.tsx b/packages/taler-wallet-webextension/src/cta/Pay.tsx
index 13fb69853..359625999 100644
--- a/packages/taler-wallet-webextension/src/cta/Pay.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Pay.tsx
@@ -105,6 +105,23 @@ export function PayPage({
     return { payStatus, balance };
   }, [NotificationType.CoinWithdrawn]);
 
+  useEffect(() => {
+    const payStatus =
+      hook && !hook.hasError ? hook.response.payStatus : undefined;
+    if (
+      payStatus &&
+      payStatus.status === PreparePayResultType.AlreadyConfirmed &&
+      payStatus.paid
+    ) {
+      const fu = payStatus.contractTerms.fulfillment_url;
+      if (fu) {
+        setTimeout(() => {
+          document.location.href = fu;
+        }, 3000);
+      }
+    }
+  }, []);
+
   if (!hook) {
     return <Loading />;
   }
@@ -172,20 +189,6 @@ export function PaymentRequestView({
   let totalFees: AmountJson = Amounts.getZero(payStatus.amountRaw);
   const contractTerms: ContractTerms = payStatus.contractTerms;
 
-  useEffect(() => {
-    if (
-      payStatus.status === PreparePayResultType.AlreadyConfirmed &&
-      payStatus.paid
-    ) {
-      const fu = payStatus.contractTerms.fulfillment_url;
-      if (fu) {
-        setTimeout(() => {
-          document.location.href = fu;
-        }, 3000);
-      }
-    }
-  });
-
   if (!contractTerms) {
     return (
       <ErrorMessage
-- 
cgit v1.2.3

