diff options
author | Sebastian <sebasjm@gmail.com> | 2022-12-15 17:11:24 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-12-15 17:11:24 -0300 |
commit | f93bd51499ed34844b666bf6d333227adf4368bf (patch) | |
tree | ed3cf0c38b7db54276436d1743a6085c94f71977 /packages/taler-wallet-webextension/src/hooks/useProviderStatus.ts | |
parent | 8d8d71807df6b775e5b0335eb1b2526a56d42ac6 (diff) | |
download | wallet-core-f93bd51499ed34844b666bf6d333227adf4368bf.tar.xz |
wxApi from context and using the new testing sdk
Diffstat (limited to 'packages/taler-wallet-webextension/src/hooks/useProviderStatus.ts')
-rw-r--r-- | packages/taler-wallet-webextension/src/hooks/useProviderStatus.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/packages/taler-wallet-webextension/src/hooks/useProviderStatus.ts b/packages/taler-wallet-webextension/src/hooks/useProviderStatus.ts index e6473d1ec..ca2054931 100644 --- a/packages/taler-wallet-webextension/src/hooks/useProviderStatus.ts +++ b/packages/taler-wallet-webextension/src/hooks/useProviderStatus.ts @@ -16,7 +16,7 @@ import { ProviderInfo, WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { useEffect, useState } from "preact/hooks"; -import { wxApi } from "../wxApi.js"; +import { useBackendContext } from "../context/backend.js"; export interface ProviderStatus { info?: ProviderInfo; @@ -26,11 +26,11 @@ export interface ProviderStatus { export function useProviderStatus(url: string): ProviderStatus | undefined { const [status, setStatus] = useState<ProviderStatus | undefined>(undefined); - + const api = useBackendContext(); useEffect(() => { async function run(): Promise<void> { //create a first list of backup info by currency - const status = await wxApi.wallet.call( + const status = await api.wallet.call( WalletApiOperation.GetBackupInfo, {}, ); @@ -42,7 +42,7 @@ export function useProviderStatus(url: string): ProviderStatus | undefined { async function sync(): Promise<void> { if (info) { - await wxApi.wallet.call(WalletApiOperation.RunBackupCycle, { + await api.wallet.call(WalletApiOperation.RunBackupCycle, { providers: [info.syncProviderBaseUrl], }); } @@ -50,7 +50,7 @@ export function useProviderStatus(url: string): ProviderStatus | undefined { async function remove(): Promise<void> { if (info) { - await wxApi.wallet.call(WalletApiOperation.RemoveBackupProvider, { + await api.wallet.call(WalletApiOperation.RemoveBackupProvider, { provider: info.syncProviderBaseUrl, }); } |