diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-05-04 18:52:54 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-05-08 17:19:07 +0530 |
commit | 76e664c9432822c4f5ba717af7f421b7cd015bf3 (patch) | |
tree | a3c020adb0f916646b6af2821734064e9abb3186 /src/webex/pages/withdraw.tsx | |
parent | 38601a1c63840bc85eae166f771a974e0629db28 (diff) | |
download | wallet-core-76e664c9432822c4f5ba717af7f421b7cd015bf3.tar.xz |
update withdrawal page when something changes
Diffstat (limited to 'src/webex/pages/withdraw.tsx')
-rw-r--r-- | src/webex/pages/withdraw.tsx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/webex/pages/withdraw.tsx b/src/webex/pages/withdraw.tsx index 1647a7065..5ef4376f7 100644 --- a/src/webex/pages/withdraw.tsx +++ b/src/webex/pages/withdraw.tsx @@ -28,9 +28,9 @@ import { WithdrawDetails } from "../../types/walletTypes"; import { WithdrawDetailView, renderAmount } from "../renderHtml"; import React, { useState, useEffect } from "react"; -import { getWithdrawDetails, acceptWithdrawal } from "../wxApi"; +import { getWithdrawDetails, acceptWithdrawal, onUpdateNotification } from "../wxApi"; -function NewExchangeSelection(props: { +function WithdrawalDialog(props: { talerWithdrawUri: string; }): JSX.Element { const [details, setDetails] = useState<WithdrawDetails | undefined>(); @@ -42,6 +42,14 @@ function NewExchangeSelection(props: { const [selecting, setSelecting] = useState(false); const [customUrl, setCustomUrl] = useState<string>(""); const [errMsg, setErrMsg] = useState<string | undefined>(""); + const [updateCounter, setUpdateCounter] = useState(1); + + useEffect(() => { + return onUpdateNotification(() => { + setUpdateCounter(updateCounter + 1); + }); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []) useEffect(() => { const fetchData = async (): Promise<void> => { @@ -65,7 +73,7 @@ function NewExchangeSelection(props: { setDetails(d); }; fetchData(); - }, [selectedExchange, errMsg, selecting, talerWithdrawUri]); + }, [selectedExchange, errMsg, selecting, talerWithdrawUri, updateCounter]); if (errMsg) { return ( @@ -214,5 +222,5 @@ export function createWithdrawPage(): JSX.Element { if (!talerWithdrawUri) { throw Error("withdraw URI required"); } - return <NewExchangeSelection talerWithdrawUri={talerWithdrawUri} />; + return <WithdrawalDialog talerWithdrawUri={talerWithdrawUri} />; } |