diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/PaymentTemplate/state.ts')
-rw-r--r-- | packages/taler-wallet-webextension/src/cta/PaymentTemplate/state.ts | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/PaymentTemplate/state.ts b/packages/taler-wallet-webextension/src/cta/PaymentTemplate/state.ts index b9257215f..6b4584fea 100644 --- a/packages/taler-wallet-webextension/src/cta/PaymentTemplate/state.ts +++ b/packages/taler-wallet-webextension/src/cta/PaymentTemplate/state.ts @@ -14,7 +14,7 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { Amounts } from "@gnu-taler/taler-util"; +import { Amounts, PreparePayResult } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { useState } from "preact/hooks"; import { alertFromError, useAlertContext } from "../../context/alert.js"; @@ -54,7 +54,7 @@ export function useComponentState({ const hook = useAsyncAsHook(async () => { if (!talerTemplateUri) throw Error("ERROR_NO-URI-FOR-PAYMENT-TEMPLATE"); - let payStatus; + let payStatus: PreparePayResult | undefined = undefined; if (!amountParam && !summaryParam) { payStatus = await api.wallet.call( WalletApiOperation.PreparePayForTemplate, @@ -125,7 +125,9 @@ export function useComponentState({ }, ); setNewOrder(payStatus.talerUri!); - } catch (e) {} + } catch (e) { + console.error(e); + } } const errors = undefinedIfEmpty({ amount: amount && Amounts.isZero(amount) ? i18n.str`required` : undefined, @@ -164,7 +166,9 @@ export function useComponentState({ } function undefinedIfEmpty<T extends object>(obj: T): T | undefined { - return Object.keys(obj).some((k) => (obj as any)[k] !== undefined) + return Object.keys(obj).some( + (k) => (obj as Record<string, unknown>)[k] !== undefined, + ) ? obj : undefined; } |