From 3f2db7707fdf4eb4c1dfdb527d5726dd1694e126 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Tue, 25 Oct 2022 12:23:08 -0300
Subject: using new wallet api (typed interface)

---
 .../src/wallet/BackupPage.tsx                      | 26 ++++++++++++----------
 1 file changed, 14 insertions(+), 12 deletions(-)

(limited to 'packages/taler-wallet-webextension/src/wallet/BackupPage.tsx')

diff --git a/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx b/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx
index bba8b5964..c9dbfb64d 100644
--- a/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx
@@ -14,11 +14,7 @@
  GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-import {
-  AbsoluteTime,
-  BackupRecovery,
-  constructRecoveryUri,
-} from "@gnu-taler/taler-util";
+import { AbsoluteTime, constructRecoveryUri } from "@gnu-taler/taler-util";
 import {
   ProviderInfo,
   ProviderPaymentPaid,
@@ -32,8 +28,10 @@ import {
   intervalToDuration,
 } from "date-fns";
 import { Fragment, h, VNode } from "preact";
+import { useEffect, useState } from "preact/hooks";
 import { Loading } from "../components/Loading.js";
 import { LoadingError } from "../components/LoadingError.js";
+import { QR } from "../components/QR.js";
 import {
   BoldLight,
   Centered,
@@ -48,10 +46,7 @@ import { useTranslationContext } from "../context/translation.js";
 import { useAsyncAsHook } from "../hooks/useAsyncAsHook.js";
 import { Button } from "../mui/Button.js";
 import { Pages } from "../NavigationBar.js";
-import * as wxApi from "../wxApi.js";
-import { wxClient } from "../wxApi.js";
-import { useEffect, useState } from "preact/hooks";
-import { QR } from "../components/QR.js";
+import { wxApi } from "../wxApi.js";
 
 interface Props {
   onAddProvider: () => Promise<void>;
@@ -112,7 +107,9 @@ export function ShowRecoveryInfo({
 
 export function BackupPage({ onAddProvider }: Props): VNode {
   const { i18n } = useTranslationContext();
-  const status = useAsyncAsHook(wxApi.getBackupInfo);
+  const status = useAsyncAsHook(() =>
+    wxApi.wallet.call(WalletApiOperation.GetBackupInfo, {}),
+  );
   const [recoveryInfo, setRecoveryInfo] = useState<string>("");
   if (!status) {
     return <Loading />;
@@ -127,7 +124,10 @@ export function BackupPage({ onAddProvider }: Props): VNode {
   }
 
   async function getRecoveryInfo(): Promise<void> {
-    const r = await wxClient.call(WalletApiOperation.ExportBackupRecovery, {});
+    const r = await wxApi.wallet.call(
+      WalletApiOperation.ExportBackupRecovery,
+      {},
+    );
     const str = constructRecoveryUri(r);
     setRecoveryInfo(str);
   }
@@ -157,7 +157,9 @@ export function BackupPage({ onAddProvider }: Props): VNode {
     <BackupView
       providers={providers}
       onAddProvider={onAddProvider}
-      onSyncAll={wxApi.syncAllProviders}
+      onSyncAll={async () =>
+        wxApi.wallet.call(WalletApiOperation.RunBackupCycle, {}).then()
+      }
       onShowInfo={getRecoveryInfo}
     />
   );
-- 
cgit v1.2.3

