diff options
author | Sebastian <sebasjm@gmail.com> | 2022-10-25 12:23:08 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-10-25 19:19:09 -0300 |
commit | a286649b0a611d87916a178a795c1acd2917741c (patch) | |
tree | 86d0a8eefb791ffebc877a88d6876d1ff764cf2b /packages/taler-wallet-webextension/src/wallet/BackupPage.tsx | |
parent | 5fcd434f662bcef7e9e043763766c8b104ad6b97 (diff) | |
download | wallet-core-a286649b0a611d87916a178a795c1acd2917741c.tar.xz |
cherry-pick: using new wallet typed api missing test
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet/BackupPage.tsx')
-rw-r--r-- | packages/taler-wallet-webextension/src/wallet/BackupPage.tsx | 26 |
1 files changed, 14 insertions, 12 deletions
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} /> ); |