summaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/components/product/NonInventoryProductForm.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/merchant-backoffice-ui/src/components/product/NonInventoryProductForm.tsx')
-rw-r--r--packages/merchant-backoffice-ui/src/components/product/NonInventoryProductForm.tsx14
1 files changed, 7 insertions, 7 deletions
diff --git a/packages/merchant-backoffice-ui/src/components/product/NonInventoryProductForm.tsx b/packages/merchant-backoffice-ui/src/components/product/NonInventoryProductForm.tsx
index 8ddd9fa95..a127999fc 100644
--- a/packages/merchant-backoffice-ui/src/components/product/NonInventoryProductForm.tsx
+++ b/packages/merchant-backoffice-ui/src/components/product/NonInventoryProductForm.tsx
@@ -13,11 +13,11 @@
You should have received a copy of the GNU General Public License along with
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
+import { AmountString, TalerMerchantApi } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact";
import { useCallback, useEffect, useState } from "preact/hooks";
import * as yup from "yup";
-import { MerchantBackend } from "../../declaration.js";
import { useListener } from "../../hooks/listener.js";
import { NonInventoryProductSchema as schema } from "../../schemas/index.js";
import { FormErrors, FormProvider } from "../form/FormProvider.js";
@@ -27,7 +27,7 @@ import { InputImage } from "../form/InputImage.js";
import { InputNumber } from "../form/InputNumber.js";
import { InputTaxes } from "../form/InputTaxes.js";
-type Entity = MerchantBackend.Product;
+type Entity = TalerMerchantApi.Product;
interface Props {
onAddProduct: (p: Entity) => Promise<void>;
@@ -46,7 +46,7 @@ export function NonInventoryProductFrom({
}, [isEditing]);
const [submitForm, addFormSubmitter] = useListener<
- Partial<MerchantBackend.Product> | undefined
+ Partial<TalerMerchantApi.Product> | undefined
>((result) => {
if (result) {
setShowCreateProduct(false);
@@ -55,7 +55,7 @@ export function NonInventoryProductFrom({
taxes: result.taxes || [],
description: result.description || "",
image: result.image || "",
- price: result.price || "",
+ price: (result.price || "") as AmountString,
unit: result.unit || "",
});
}
@@ -136,7 +136,7 @@ interface NonInventoryProduct {
unit: string;
price: string;
image: string;
- taxes: MerchantBackend.Tax[];
+ taxes: TalerMerchantApi.Tax[];
}
export function ProductForm({ onSubscribe, initial }: ProductProps): VNode {
@@ -144,7 +144,7 @@ export function ProductForm({ onSubscribe, initial }: ProductProps): VNode {
taxes: [],
...initial,
});
- let errors: FormErrors<Entity> = {};
+ let errors: FormErrors<NonInventoryProduct> = {};
try {
schema.validateSync(value, { abortEarly: false });
} catch (err) {
@@ -159,7 +159,7 @@ export function ProductForm({ onSubscribe, initial }: ProductProps): VNode {
}
const submit = useCallback((): Entity | undefined => {
- return value as MerchantBackend.Product;
+ return value as TalerMerchantApi.Product;
}, [value]);
const hasErrors = Object.keys(errors).some(