summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/wallet/History.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/History.tsx
parent1e6b2dd150416d4acfac4cf4068c41edb036d5e0 (diff)
downloadwallet-core-65e6a8caa0de98632ad99cca35bf98bffe663dff.tar.gz
wallet-core-65e6a8caa0de98632ad99cca35bf98bffe663dff.tar.bz2
wallet-core-65e6a8caa0de98632ad99cca35bf98bffe663dff.zip
useAsync new API
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet/History.tsx')
-rw-r--r--packages/taler-wallet-webextension/src/wallet/History.tsx21
1 files changed, 12 insertions, 9 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/History.tsx b/packages/taler-wallet-webextension/src/wallet/History.tsx
index 51ffcb31a..cc99a8d0b 100644
--- a/packages/taler-wallet-webextension/src/wallet/History.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/History.tsx
@@ -21,7 +21,7 @@ import {
Transaction,
} from "@gnu-taler/taler-util";
import { Fragment, 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 {
@@ -35,7 +35,7 @@ import {
import { Time } from "../components/Time.js";
import { TransactionItem } from "../components/TransactionItem.js";
import { useTranslationContext } from "../context/translation.js";
-import { useAsyncAsHook } from "../hooks/useAsyncAsHook.js";
+import { useAsyncAsHook2 } from "../hooks/useAsyncAsHook.js";
import { NoBalanceHelp } from "../popup/NoBalanceHelp.js";
import * as wxApi from "../wxApi.js";
@@ -50,13 +50,16 @@ export function HistoryPage({
goToWalletDeposit,
}: Props): VNode {
const { i18n } = useTranslationContext();
- const state = useAsyncAsHook(
- async () => ({
- b: await wxApi.getBalance(),
- tx: await wxApi.getTransactions(),
- }),
- [NotificationType.WithdrawGroupFinished],
- );
+ const state = useAsyncAsHook2(async () => ({
+ b: await wxApi.getBalance(),
+ tx: await wxApi.getTransactions(),
+ }));
+
+ useEffect(() => {
+ wxApi.onUpdateNotification([NotificationType.WithdrawGroupFinished], () => {
+ state?.retry();
+ });
+ });
if (!state) {
return <Loading />;