diff options
author | Sebastian <sebasjm@gmail.com> | 2022-11-16 16:04:52 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-11-16 16:05:13 -0300 |
commit | 1a63d56bfdd091cc7aefdf1e25f3a074bfdf5e0e (patch) | |
tree | 7255cf4a5b51af4807e2a01a370497413a78968f /packages/taler-wallet-webextension/src/wallet/ManageAccount | |
parent | 53164dc47b1138235a0c797affaa6fb37ea43239 (diff) | |
download | wallet-core-1a63d56bfdd091cc7aefdf1e25f3a074bfdf5e0e.tar.xz |
fix #7411, also making the backup payment visible
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet/ManageAccount')
-rw-r--r-- | packages/taler-wallet-webextension/src/wallet/ManageAccount/index.ts | 8 | ||||
-rw-r--r-- | packages/taler-wallet-webextension/src/wallet/ManageAccount/state.ts | 34 |
2 files changed, 24 insertions, 18 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/ManageAccount/index.ts b/packages/taler-wallet-webextension/src/wallet/ManageAccount/index.ts index cd591be74..df4e7586f 100644 --- a/packages/taler-wallet-webextension/src/wallet/ManageAccount/index.ts +++ b/packages/taler-wallet-webextension/src/wallet/ManageAccount/index.ts @@ -20,7 +20,7 @@ import { HookError } from "../../hooks/useAsyncAsHook.js"; import { ButtonHandler, SelectFieldHandler, - TextFieldHandler + TextFieldHandler, } from "../../mui/handlers.js"; import { compose, StateViewMap } from "../../utils/index.js"; import { wxApi } from "../../wxApi.js"; @@ -58,13 +58,13 @@ export namespace State { alias: TextFieldHandler; onAccountAdded: ButtonHandler; onCancel: ButtonHandler; - accountByType: AccountByType, - deleteAccount: (a: KnownBankAccountsInfo) => Promise<void>, + accountByType: AccountByType; + deleteAccount: (a: KnownBankAccountsInfo) => Promise<void>; } } export type AccountByType = { - [key: string]: KnownBankAccountsInfo[] + [key: string]: KnownBankAccountsInfo[]; }; const viewMapping: StateViewMap<State> = { 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 <http://www.gnu.org/licenses/> */ -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<void> { const payto = stringifyPaytoUri(account.uri); await api.wallet.call(WalletApiOperation.ForgetKnownBankAccounts, { - payto - }) - hook?.retry() + payto, + }); + hook?.retry(); } return { |