aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/components/form/InputCurrency.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/merchant-backoffice-ui/src/components/form/InputCurrency.tsx')
-rw-r--r--packages/merchant-backoffice-ui/src/components/form/InputCurrency.tsx11
1 files changed, 6 insertions, 5 deletions
diff --git a/packages/merchant-backoffice-ui/src/components/form/InputCurrency.tsx b/packages/merchant-backoffice-ui/src/components/form/InputCurrency.tsx
index b02354d7c..11396b88e 100644
--- a/packages/merchant-backoffice-ui/src/components/form/InputCurrency.tsx
+++ b/packages/merchant-backoffice-ui/src/components/form/InputCurrency.tsx
@@ -1,6 +1,6 @@
/*
This file is part of GNU Taler
- (C) 2021-2023 Taler Systems S.A.
+ (C) 2021-2024 Taler Systems S.A.
GNU Taler is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -18,11 +18,12 @@
*
* @author Sebastian Javier Marchano (sebasjm)
*/
+import { useMerchantApiContext } from "@gnu-taler/web-util/browser";
import { ComponentChildren, h, VNode } from "preact";
-import { useConfigContext } from "../../context/config.js";
-import { Amount } from "../../declaration.js";
import { InputWithAddon } from "./InputWithAddon.js";
import { InputProps } from "./useField.js";
+import { AmountString } from "@gnu-taler/taler-util";
+import { useSessionContext } from "../../context/session.js";
export interface Props<T> extends InputProps<T> {
expand?: boolean;
@@ -43,7 +44,7 @@ export function InputCurrency<T>({
children,
side,
}: Props<keyof T>): VNode {
- const config = useConfigContext();
+ const { config } = useSessionContext();
return (
<InputWithAddon<T>
name={name}
@@ -57,7 +58,7 @@ export function InputCurrency<T>({
addonAfter={addonAfter}
inputType="number"
expand={expand}
- toStr={(v?: Amount) => v?.split(":")[1] || ""}
+ toStr={(v?: AmountString) => v?.split(":")[1] || ""}
fromStr={(v: string) => (!v ? undefined : `${config.currency}:${v}`)}
inputExtra={{ min: 0 }}
>