gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant-backoffice] branch master updated: prevent re-rendering


From: gnunet
Subject: [taler-merchant-backoffice] branch master updated: prevent re-rendering QR code after reload
Date: Fri, 09 Sep 2022 17:37:37 +0200

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a commit to branch master
in repository merchant-backoffice.

The following commit(s) were added to refs/heads/master by this push:
     new ffc0198  prevent re-rendering QR code after reload
ffc0198 is described below

commit ffc019841bf911256ac909f14c0441781b5dee6e
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Fri Sep 9 12:36:13 2022 -0300

    prevent re-rendering QR code after reload
---
 packages/bank/src/pages/home/index.tsx | 38 ++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/packages/bank/src/pages/home/index.tsx 
b/packages/bank/src/pages/home/index.tsx
index de9426a..a7cda01 100644
--- a/packages/bank/src/pages/home/index.tsx
+++ b/packages/bank/src/pages/home/index.tsx
@@ -1103,6 +1103,25 @@ function TalerWithdrawalConfirmationQuestion(Props: 
any): VNode {
   </Fragment>);
 }
 
+function QrCodeSection({talerWithdrawUri, 
abortButton}:{talerWithdrawUri:string, abortButton: h.JSX.Element}) {
+  const i18n = useTranslator();
+  useEffect(() => {
+    //Taler Wallet WebExtension is listening to headers response and tab 
updates.
+    //In the SPA there is no header response with the Taler URI so 
+    //this hack manually triggers the tab update after the QR is in the DOM.
+    window.location.href = window.location.href.split("#")[0] + "#"
+  },[])
+
+  return <section id="main" class="content">
+  <h1 class="nav">{i18n`Withdraw to a Taler Wallet`}</h1>
+  <p>{i18n`You can use this QR code to withdraw to your mobile wallet:`}</p>
+  {QR({text: talerWithdrawUri})}
+  <p>Click <a id="linkqr" href={talerWithdrawUri}>{i18n`this link`}</a> to 
open your Taler wallet!</p>
+  <br />
+  {abortButton}
+  </section>
+}
+
 /**
  * Offer the QR code (and a clickable taler://-link) to
  * permit the passing of exchange and reserve details to
@@ -1163,26 +1182,9 @@ function TalerWithdrawalQRCode(Props: any): VNode {
     })
   }
 
-  function QrCodeSection() {
-    useEffect(() => {
-      //Taler Wallet WebExtension is listening to headers response and tab 
updates.
-      //In the SPA there is no header response with the Taler URI so 
-      //this hack manually triggers the tab update after the QR is in the DOM.
-      window.location.href = window.location.href.split("#")[0] + "#"
-    },[])
-  
-    return <section id="main" class="content">
-    <h1 class="nav">{i18n`Withdraw to a Taler Wallet`}</h1>
-    <p>{i18n`You can use this QR code to withdraw to your mobile wallet:`}</p>
-    {QR({text: talerWithdrawUri})}
-    <p>Click <a id="linkqr" href={talerWithdrawUri}>{i18n`this link`}</a> to 
open your Taler wallet!</p>
-    <br />
-    {abortButton}
-    </section>
-  }
   if (!data.selection_done) {
     setTimeout(() => mutate(), 1000); // check again after 1 second.
-    return (<QrCodeSection />);
+    return (<QrCodeSection talerWithdrawUri={talerWithdrawUri} 
abortButton={abortButton} />);
   }
   /**
    * Wallet POSTed the withdrawal details!  Ask the

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]