summaryrefslogtreecommitdiff
path: root/src/webex/pages/withdraw.tsx
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-04-07 13:37:32 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-04-07 13:37:32 +0530
commitfb2e2f89935240666de66e4b2c11125cb3b2943d (patch)
tree7b7e148e6cce7bf7639a5e35102f5269f5920ab5 /src/webex/pages/withdraw.tsx
parent1471aae8927c20d646cc2aa5ab0e20c1a7f2c0ca (diff)
downloadwallet-core-fb2e2f89935240666de66e4b2c11125cb3b2943d.tar.gz
wallet-core-fb2e2f89935240666de66e4b2c11125cb3b2943d.tar.bz2
wallet-core-fb2e2f89935240666de66e4b2c11125cb3b2943d.zip
more lint fixes
Diffstat (limited to 'src/webex/pages/withdraw.tsx')
-rw-r--r--src/webex/pages/withdraw.tsx23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/webex/pages/withdraw.tsx b/src/webex/pages/withdraw.tsx
index 9020ddb0b..efd0adc86 100644
--- a/src/webex/pages/withdraw.tsx
+++ b/src/webex/pages/withdraw.tsx
@@ -30,7 +30,9 @@ import { WithdrawDetailView, renderAmount } from "../renderHtml";
import React, { useState, useEffect } from "react";
import { getWithdrawDetails, acceptWithdrawal } from "../wxApi";
-function NewExchangeSelection(props: { talerWithdrawUri: string }): JSX.Element {
+function NewExchangeSelection(props: {
+ talerWithdrawUri: string;
+}): JSX.Element {
const [details, setDetails] = useState<WithdrawDetails | undefined>();
const [selectedExchange, setSelectedExchange] = useState<
string | undefined
@@ -63,7 +65,7 @@ function NewExchangeSelection(props: { talerWithdrawUri: string }): JSX.Element
setDetails(d);
};
fetchData();
- }, [selectedExchange, errMsg, selecting]);
+ }, [selectedExchange, errMsg, selecting, talerWithdrawUri]);
if (errMsg) {
return (
@@ -145,8 +147,11 @@ function NewExchangeSelection(props: { talerWithdrawUri: string }): JSX.Element
}
const accept = async (): Promise<void> => {
+ if (!selectedExchange) {
+ throw Error("can't accept, no exchange selected");
+ }
console.log("accepting exchange", selectedExchange);
- const res = await acceptWithdrawal(talerWithdrawUri, selectedExchange!);
+ const res = await acceptWithdrawal(talerWithdrawUri, selectedExchange);
console.log("accept withdrawal response", res);
if (res.confirmTransferUrl) {
document.location.href = res.confirmTransferUrl;
@@ -198,9 +203,9 @@ function NewExchangeSelection(props: { talerWithdrawUri: string }): JSX.Element
export function createWithdrawPage(): JSX.Element {
const url = new URL(document.location.href);
- const talerWithdrawUri = url.searchParams.get("talerWithdrawUri");
- if (!talerWithdrawUri) {
- throw Error("withdraw URI required");
- }
- return <NewExchangeSelection talerWithdrawUri={talerWithdrawUri} />;
-} \ No newline at end of file
+ const talerWithdrawUri = url.searchParams.get("talerWithdrawUri");
+ if (!talerWithdrawUri) {
+ throw Error("withdraw URI required");
+ }
+ return <NewExchangeSelection talerWithdrawUri={talerWithdrawUri} />;
+}