diff options
author | Sebastian <sebasjm@gmail.com> | 2022-12-15 17:12:03 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-12-15 17:12:03 -0300 |
commit | f1f8f818dbe631fbeeba64af9dfcae1aa7842615 (patch) | |
tree | 856d3b443556ce271c3e9fdab6aed7ae7728ab65 /packages/taler-wallet-webextension/src/cta/Withdraw/state.ts | |
parent | f93bd51499ed34844b666bf6d333227adf4368bf (diff) | |
download | wallet-core-f1f8f818dbe631fbeeba64af9dfcae1aa7842615.tar.xz |
pretty
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Withdraw/state.ts')
-rw-r--r-- | packages/taler-wallet-webextension/src/cta/Withdraw/state.ts | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts b/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts index 4420221fc..1ecf05eca 100644 --- a/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts +++ b/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts @@ -19,7 +19,7 @@ import { AmountJson, Amounts, ExchangeListItem, - ExchangeTosStatus + ExchangeTosStatus, } from "@gnu-taler/taler-util"; import { TalerError, WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { useState } from "preact/hooks"; @@ -29,10 +29,12 @@ import { useSelectedExchange } from "../../hooks/useSelectedExchange.js"; import { RecursiveState } from "../../utils/index.js"; import { PropsFromParams, PropsFromURI, State } from "./index.js"; -export function useComponentStateFromParams( - { amount, cancel, onSuccess }: PropsFromParams, -): RecursiveState<State> { - const api = useBackendContext() +export function useComponentStateFromParams({ + amount, + cancel, + onSuccess, +}: PropsFromParams): RecursiveState<State> { + const api = useBackendContext(); const uriInfoHook = useAsyncAsHook(async () => { const exchanges = await api.wallet.call( WalletApiOperation.ListExchanges, @@ -87,10 +89,12 @@ export function useComponentStateFromParams( ); } -export function useComponentStateFromURI( - { talerWithdrawUri, cancel, onSuccess }: PropsFromURI, -): RecursiveState<State> { - const api = useBackendContext() +export function useComponentStateFromURI({ + talerWithdrawUri, + cancel, + onSuccess, +}: PropsFromURI): RecursiveState<State> { + const api = useBackendContext(); /** * Ask the wallet about the withdraw URI */ @@ -175,7 +179,7 @@ function exchangeSelectionState( exchangeList: ExchangeListItem[], defaultExchange: string | undefined, ): RecursiveState<State> { - const api = useBackendContext() + const api = useBackendContext(); const selectedExchange = useSelectedExchange({ currency: chosenAmount.currency, defaultExchange, @@ -276,10 +280,10 @@ function exchangeSelectionState( //TODO: calculate based on exchange info const ageRestriction = ageRestrictionEnabled ? { - list: ageRestrictionOptions, - value: String(ageRestricted), - onChange: async (v: string) => setAgeRestricted(parseInt(v, 10)), - } + list: ageRestrictionOptions, + value: String(ageRestricted), + onChange: async (v: string) => setAgeRestricted(parseInt(v, 10)), + } : undefined; return { |