From 1a63d56bfdd091cc7aefdf1e25f3a074bfdf5e0e Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 16 Nov 2022 16:04:52 -0300 Subject: fix #7411, also making the backup payment visible --- .../src/wallet/ManageAccount/state.ts | 34 +++++++++++++--------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'packages/taler-wallet-webextension/src/wallet/ManageAccount/state.ts') diff --git a/packages/taler-wallet-webextension/src/wallet/ManageAccount/state.ts b/packages/taler-wallet-webextension/src/wallet/ManageAccount/state.ts index f180fc1c0..1f920f05f 100644 --- a/packages/taler-wallet-webextension/src/wallet/ManageAccount/state.ts +++ b/packages/taler-wallet-webextension/src/wallet/ManageAccount/state.ts @@ -14,7 +14,11 @@ GNU Taler; see the file COPYING. If not, see */ -import { KnownBankAccountsInfo, parsePaytoUri, stringifyPaytoUri } from "@gnu-taler/taler-util"; +import { + KnownBankAccountsInfo, + parsePaytoUri, + stringifyPaytoUri, +} from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { useState } from "preact/hooks"; import { useAsyncAsHook } from "../../hooks/useAsyncAsHook.js"; @@ -25,7 +29,9 @@ export function useComponentState( { currency, onAccountAdded, onCancel }: Props, api: typeof wxApi, ): State { - const hook = useAsyncAsHook(() => api.wallet.call(WalletApiOperation.ListKnownBankAccounts, { currency })); + const hook = useAsyncAsHook(() => + api.wallet.call(WalletApiOperation.ListKnownBankAccounts, { currency }), + ); const [payto, setPayto] = useState(""); const [alias, setAlias] = useState(""); @@ -61,34 +67,34 @@ export function useComponentState( const normalizedPayto = stringifyPaytoUri(uri); await api.wallet.call(WalletApiOperation.AddKnownBankAccounts, { - alias, currency, payto: normalizedPayto + alias, + currency, + payto: normalizedPayto, }); onAccountAdded(payto); } - const paytoUriError = - found - ? "that account is already present" - : undefined; + const paytoUriError = found ? "that account is already present" : undefined; - const unableToAdd = !type || !alias || paytoUriError !== undefined || uri === undefined; + const unableToAdd = + !type || !alias || paytoUriError !== undefined || uri === undefined; const accountByType: AccountByType = { iban: [], bitcoin: [], "x-taler-bank": [], - } + }; - hook.response.accounts.forEach(acc => { - accountByType[acc.uri.targetType].push(acc) + hook.response.accounts.forEach((acc) => { + accountByType[acc.uri.targetType].push(acc); }); async function deleteAccount(account: KnownBankAccountsInfo): Promise { const payto = stringifyPaytoUri(account.uri); await api.wallet.call(WalletApiOperation.ForgetKnownBankAccounts, { - payto - }) - hook?.retry() + payto, + }); + hook?.retry(); } return { -- cgit v1.2.3