From 3f2db7707fdf4eb4c1dfdb527d5726dd1694e126 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 25 Oct 2022 12:23:08 -0300 Subject: using new wallet api (typed interface) --- .../src/popup/BalancePage.tsx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'packages/taler-wallet-webextension/src/popup') 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 { -- cgit v1.2.3