diff options
Diffstat (limited to 'src/webex/pages/add-auditor.tsx')
-rw-r--r-- | src/webex/pages/add-auditor.tsx | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/webex/pages/add-auditor.tsx b/src/webex/pages/add-auditor.tsx index 7e3e06322..766db9c5d 100644 --- a/src/webex/pages/add-auditor.tsx +++ b/src/webex/pages/add-auditor.tsx @@ -23,7 +23,6 @@ import { CurrencyRecord } from "../../dbTypes"; import { getCurrencies, updateCurrency } from "../wxApi"; import React, { useState } from "react"; -import URI = require("urijs"); import { registerMountPage } from "../renderHtml"; interface ConfirmAuditorProps { @@ -118,14 +117,24 @@ function ConfirmAuditor(props: ConfirmAuditorProps) { registerMountPage(() => { - const walletPageUrl = new URI(document.location.href); - const query: any = JSON.parse( - (URI.parseQuery(walletPageUrl.query()) as any).req, - ); - const url = query.url; - const currency: string = query.currency; - const auditorPub: string = query.auditorPub; - const expirationStamp = Number.parseInt(query.expirationStamp); + const walletPageUrl = new URL(document.location.href); + const url = walletPageUrl.searchParams.get("url"); + if (!url) { + throw Error("missign parameter (url)"); + } + const currency = walletPageUrl.searchParams.get("currency"); + if (!currency) { + throw Error("missing parameter (currency)"); + } + const auditorPub = walletPageUrl.searchParams.get("auditorPub"); + if (!auditorPub) { + throw Error("missing parameter (auditorPub)"); + } + const auditorStampStr = walletPageUrl.searchParams.get("expirationStamp"); + if (!auditorStampStr) { + throw Error("missing parameter (auditorStampStr)"); + } + const expirationStamp = Number.parseInt(auditorStampStr); const args = { url, currency, auditorPub, expirationStamp }; return <ConfirmAuditor {...args}/>; }); |