From e1369ff7e8fc02116b9c4261036f0e42e3423cf4 Mon Sep 17 00:00:00 2001
From: Florian Dold <florian.dold@gmail.com>
Date: Mon, 2 Dec 2019 00:42:40 +0100
Subject: the giant refactoring: split wallet into multiple parts

---
 src/webex/pages/add-auditor.tsx | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

(limited to 'src/webex/pages/add-auditor.tsx')

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}/>;
 });
-- 
cgit v1.2.3

