commit a3a7a7ef38ede66ac7e73bfeb855b13b84bd1b61
parent fb8c52b29bc702aece4b38e14c4bb2741d330c31
Author: Sebastian <sebasjm@gmail.com>
Date: Wed, 7 Sep 2022 13:04:40 -0300
wait the qr code in the qr section to be in the dom
Diffstat:
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/packages/bank/src/pages/home/index.tsx b/packages/bank/src/pages/home/index.tsx
@@ -1071,12 +1071,7 @@ function TalerWithdrawalQRCode(Props: any): VNode {
// waiting for the wallet:
const { data, error, mutate } = useSWR(`integration-api/withdrawal-operation/${withdrawalId}`);
- 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] + "#"
- },[])
+
if (typeof error !== "undefined") {
console.log(`withdrawal (${withdrawalId}) was never (correctly) created at the bank...`, error);
pageStateSetter((prevState: PageStateType) => ({
@@ -1111,16 +1106,27 @@ 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 (<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 href={talerWithdrawUri}>{i18n`this link`}</a> to open your Taler wallet!</p>
- <br />
- {abortButton}
- </section>);
+ return (<QrCodeSection />);
}
/**
* Wallet POSTed the withdrawal details! Ask the