diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Withdraw/state.ts')
-rw-r--r-- | packages/taler-wallet-webextension/src/cta/Withdraw/state.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts b/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts index 18c467aae..5f149064c 100644 --- a/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts +++ b/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts @@ -23,7 +23,7 @@ import { } from "@gnu-taler/taler-util"; import { TalerError, WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { useState } from "preact/hooks"; -import { alertFromError } from "../../context/alert.js"; +import { alertFromError, useAlertContext } from "../../context/alert.js"; import { useBackendContext } from "../../context/backend.js"; import { useTranslationContext } from "../../context/translation.js"; import { useAsyncAsHook } from "../../hooks/useAsyncAsHook.js"; @@ -205,6 +205,7 @@ function exchangeSelectionState( return () => { const { i18n } = useTranslationContext(); + const { pushAlertOnError } = useAlertContext(); const [ageRestricted, setAgeRestricted] = useState(0); const currentExchange = selectedExchange.selected; const tosNeedToBeAccepted = @@ -299,7 +300,9 @@ function exchangeSelectionState( ? { list: ageRestrictionOptions, value: String(ageRestricted), - onChange: async (v: string) => setAgeRestricted(parseInt(v, 10)), + onChange: pushAlertOnError(async (v: string) => + setAgeRestricted(parseInt(v, 10)), + ), } : undefined; @@ -317,7 +320,7 @@ function exchangeSelectionState( onClick: doingWithdraw || tosNeedToBeAccepted ? undefined - : doWithdrawAndCheckError, + : pushAlertOnError(doWithdrawAndCheckError), error: withdrawError, }, onTosUpdate, |