diff options
author | Sebastian <sebasjm@gmail.com> | 2022-04-25 22:37:41 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-04-26 11:48:28 -0300 |
commit | 65e6a8caa0de98632ad99cca35bf98bffe663dff (patch) | |
tree | 53bd9ec1c376e9cb73c57ba4ce223899c0b0751e /packages/taler-wallet-webextension/src/components | |
parent | 1e6b2dd150416d4acfac4cf4068c41edb036d5e0 (diff) | |
download | wallet-core-65e6a8caa0de98632ad99cca35bf98bffe663dff.tar.xz |
useAsync new API
Diffstat (limited to 'packages/taler-wallet-webextension/src/components')
-rw-r--r-- | packages/taler-wallet-webextension/src/components/PendingTransactions.tsx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx b/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx index f37a212f7..0f1806fbf 100644 --- a/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx +++ b/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx @@ -5,7 +5,8 @@ import { Transaction, } from "@gnu-taler/taler-util"; import { Fragment, h, JSX, VNode } from "preact"; -import { useAsyncAsHook } from "../hooks/useAsyncAsHook.js"; +import { useEffect } from "preact/hooks"; +import { useAsyncAsHook, useAsyncAsHook2 } from "../hooks/useAsyncAsHook.js"; import { Avatar } from "../mui/Avatar.js"; import { Typography } from "../mui/Typography.js"; import * as wxApi from "../wxApi.js"; @@ -17,9 +18,14 @@ interface Props extends JSX.HTMLAttributes { } export function PendingTransactions({ goToTransaction }: Props): VNode { - const state = useAsyncAsHook(wxApi.getTransactions, [ - NotificationType.WithdrawGroupFinished, - ]); + const state = useAsyncAsHook2(wxApi.getTransactions); + + useEffect(() => { + wxApi.onUpdateNotification([NotificationType.WithdrawGroupFinished], () => { + state?.retry(); + }); + }); + const transactions = !state || state.hasError ? [] |