From a286649b0a611d87916a178a795c1acd2917741c Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 25 Oct 2022 12:23:08 -0300 Subject: cherry-pick: using new wallet typed api missing test --- .../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 */ -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; @@ -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(""); if (!status) { return ; @@ -127,7 +124,10 @@ export function BackupPage({ onAddProvider }: Props): VNode { } async function getRecoveryInfo(): Promise { - 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 { + wxApi.wallet.call(WalletApiOperation.RunBackupCycle, {}).then() + } onShowInfo={getRecoveryInfo} /> ); -- cgit v1.2.3