diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-09-05 16:23:54 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-09-05 16:23:54 +0200 |
commit | 51aa6d81464afe92e60f13281d4fda3bb54c45ba (patch) | |
tree | bdd7bd364d7af067976c276c5ee9065dac0133a5 /src/webex/pages/pay.tsx | |
parent | 8144b0f5535c3d00c1e508cddce3cd88a153a581 (diff) | |
download | wallet-core-51aa6d81464afe92e60f13281d4fda3bb54c45ba.tar.xz |
refactor / format
Diffstat (limited to 'src/webex/pages/pay.tsx')
-rw-r--r-- | src/webex/pages/pay.tsx | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/src/webex/pages/pay.tsx b/src/webex/pages/pay.tsx index 95d12b69a..c266f6d48 100644 --- a/src/webex/pages/pay.tsx +++ b/src/webex/pages/pay.tsx @@ -24,19 +24,13 @@ */ import * as i18n from "../../i18n"; -import { runOnceWhenReady } from "./common"; - -import { ExchangeRecord, ProposalDownloadRecord } from "../../dbTypes"; -import { ContractTerms } from "../../talerTypes"; import { CheckPayResult, PreparePayResult } from "../../walletTypes"; -import { renderAmount, ProgressButton } from "../renderHtml"; +import { renderAmount, ProgressButton, registerMountPage } from "../renderHtml"; import * as wxApi from "../wxApi"; import React, { useState, useEffect } from "react"; -import * as ReactDOM from "react-dom"; import URI = require("urijs"); -import { WalletApiError } from "../wxApi"; import * as Amounts from "../../amounts"; @@ -153,22 +147,11 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }) { ); } -runOnceWhenReady(() => { - try { - const url = new URI(document.location.href); - const query: any = URI.parseQuery(url.query()); +registerMountPage(() => { + const url = new URI(document.location.href); + const query: any = URI.parseQuery(url.query()); - let talerPayUri = query.talerPayUri; + let talerPayUri = query.talerPayUri; - ReactDOM.render( - <TalerPayDialog talerPayUri={talerPayUri} />, - document.getElementById("contract")!, - ); - } catch (e) { - ReactDOM.render( - <span>Fatal error: {e.message}</span>, - document.getElementById("contract")!, - ); - console.error(e); - } + return <TalerPayDialog talerPayUri={talerPayUri} />; }); |