aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-10-25 12:23:08 -0300
committerSebastian <sebasjm@gmail.com>2022-10-25 19:19:09 -0300
commita286649b0a611d87916a178a795c1acd2917741c (patch)
tree86d0a8eefb791ffebc877a88d6876d1ff764cf2b /packages/taler-wallet-webextension/src/popup/BalancePage.tsx
parent5fcd434f662bcef7e9e043763766c8b104ad6b97 (diff)
cherry-pick: using new wallet typed api missing test
Diffstat (limited to 'packages/taler-wallet-webextension/src/popup/BalancePage.tsx')
-rw-r--r--packages/taler-wallet-webextension/src/popup/BalancePage.tsx19
1 files changed, 10 insertions, 9 deletions
diff --git a/packages/taler-wallet-webextension/src/popup/BalancePage.tsx b/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
index 94d5d1e16..98c6d166c 100644
--- a/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
+++ b/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
@@ -15,6 +15,7 @@
*/
import { Amounts, Balance, NotificationType } from "@gnu-taler/taler-util";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { Fragment, h, VNode } from "preact";
import { useEffect, useState } from "preact/hooks";
import { BalanceTable } from "../components/BalanceTable.js";
@@ -27,7 +28,7 @@ import { Button } from "../mui/Button.js";
import { ButtonHandler } from "../mui/handlers.js";
import { compose, StateViewMap } from "../utils/index.js";
import { AddNewActionView } from "../wallet/AddNewActionView.js";
-import * as wxApi from "../wxApi.js";
+import { wxApi } from "../wxApi.js";
import { NoBalanceHelp } from "./NoBalanceHelp.js";
export interface Props {
@@ -71,16 +72,16 @@ function useComponentState(
api: typeof wxApi,
): State {
const [addingAction, setAddingAction] = useState(false);
- const state = useAsyncAsHook(api.getBalance);
+ const state = useAsyncAsHook(() =>
+ api.wallet.call(WalletApiOperation.GetBalances, {}),
+ );
- useEffect(() => {
- return api.onUpdateNotification(
+ useEffect(() =>
+ api.listener.onUpdateNotification(
[NotificationType.WithdrawGroupFinished],
- () => {
- state?.retry();
- },
- );
- });
+ state?.retry,
+ ),
+ );
if (!state) {
return {