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/hooks/useProviderStatus.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'packages/taler-wallet-webextension/src/hooks/useProviderStatus.ts') diff --git a/packages/taler-wallet-webextension/src/hooks/useProviderStatus.ts b/packages/taler-wallet-webextension/src/hooks/useProviderStatus.ts index 187517b41..b73c9fc16 100644 --- a/packages/taler-wallet-webextension/src/hooks/useProviderStatus.ts +++ b/packages/taler-wallet-webextension/src/hooks/useProviderStatus.ts @@ -14,9 +14,9 @@ GNU Taler; see the file COPYING. If not, see */ -import { ProviderInfo } from "@gnu-taler/taler-wallet-core"; +import { ProviderInfo, WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { useEffect, useState } from "preact/hooks"; -import * as wxApi from "../wxApi.js"; +import { wxApi } from "../wxApi.js"; export interface ProviderStatus { info?: ProviderInfo; @@ -30,7 +30,7 @@ export function useProviderStatus(url: string): ProviderStatus | undefined { useEffect(() => { async function run(): Promise { //create a first list of backup info by currency - const status = await wxApi.getBackupInfo(); + const status = await wxApi.wallet.call(WalletApiOperation.GetBackupInfo, {}); const providers = status.providers.filter( (p) => p.syncProviderBaseUrl === url, @@ -39,13 +39,17 @@ export function useProviderStatus(url: string): ProviderStatus | undefined { async function sync(): Promise { if (info) { - await wxApi.syncOneProvider(info.syncProviderBaseUrl); + await wxApi.wallet.call(WalletApiOperation.RunBackupCycle, { + providers: [info.syncProviderBaseUrl] + }); } } async function remove(): Promise { if (info) { - await wxApi.removeProvider(info.syncProviderBaseUrl); + await wxApi.wallet.call(WalletApiOperation.RemoveBackupProvider, { + provider: info.syncProviderBaseUrl + }); } } -- cgit v1.2.3