aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-04-25 22:37:41 -0300
committerSebastian <sebasjm@gmail.com>2022-04-26 11:48:28 -0300
commit65e6a8caa0de98632ad99cca35bf98bffe663dff (patch)
tree53bd9ec1c376e9cb73c57ba4ce223899c0b0751e /packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx
parent1e6b2dd150416d4acfac4cf4068c41edb036d5e0 (diff)
downloadwallet-core-65e6a8caa0de98632ad99cca35bf98bffe663dff.tar.xz
useAsync new API
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx')
-rw-r--r--packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx13
1 files changed, 8 insertions, 5 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx b/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx
index 8b8d375de..1d0e81e01 100644
--- a/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx
@@ -23,11 +23,11 @@ import {
PaytoUri,
} from "@gnu-taler/taler-util";
import { h, VNode } from "preact";
-import { useState } from "preact/hooks";
+import { useEffect, useState } from "preact/hooks";
import { Loading } from "../components/Loading.js";
import { LoadingError } from "../components/LoadingError.js";
import { useTranslationContext } from "../context/translation.js";
-import { useAsyncAsHook } from "../hooks/useAsyncAsHook.js";
+import { useAsyncAsHook, useAsyncAsHook2 } from "../hooks/useAsyncAsHook.js";
import * as wxApi from "../wxApi.js";
import { CreateManualWithdraw } from "./CreateManualWithdraw.js";
import { ReserveCreated } from "./ReserveCreated.js";
@@ -50,9 +50,12 @@ export function ManualWithdrawPage({ currency, onCancel }: Props): VNode {
>(undefined);
const [error, setError] = useState<string | undefined>(undefined);
- const state = useAsyncAsHook(wxApi.listExchanges, [
- NotificationType.ExchangeAdded,
- ]);
+ const state = useAsyncAsHook2(wxApi.listExchanges);
+ useEffect(() => {
+ wxApi.onUpdateNotification([NotificationType.ExchangeAdded], () => {
+ state?.retry();
+ });
+ });
const { i18n } = useTranslationContext();
async function doCreate(