aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/components/tokenfamily
diff options
context:
space:
mode:
authorChristian Blättler <blatc2@bfh.ch>2024-01-18 11:46:53 +0100
committerChristian Blättler <blatc2@bfh.ch>2024-01-18 11:46:53 +0100
commitca12c07abd1ca9083373e9f2a3f872573759b0ac (patch)
tree5d0e42b4843ee6b3d8e269a7e8c2bd36a1053df3 /packages/merchant-backoffice-ui/src/components/tokenfamily
parent2094278819b6290d17b3e84e27782ba287e429b0 (diff)
downloadwallet-core-ca12c07abd1ca9083373e9f2a3f872573759b0ac.tar.xz
add token family update page
Diffstat (limited to 'packages/merchant-backoffice-ui/src/components/tokenfamily')
-rw-r--r--packages/merchant-backoffice-ui/src/components/tokenfamily/TokenFamilyForm.tsx40
1 files changed, 15 insertions, 25 deletions
diff --git a/packages/merchant-backoffice-ui/src/components/tokenfamily/TokenFamilyForm.tsx b/packages/merchant-backoffice-ui/src/components/tokenfamily/TokenFamilyForm.tsx
index 420466eaa..95441b9fa 100644
--- a/packages/merchant-backoffice-ui/src/components/tokenfamily/TokenFamilyForm.tsx
+++ b/packages/merchant-backoffice-ui/src/components/tokenfamily/TokenFamilyForm.tsx
@@ -25,10 +25,7 @@ import { useCallback, useEffect, useState } from "preact/hooks";
import * as yup from "yup";
import { useBackendContext } from "../../context/backend.js";
import { MerchantBackend } from "../../declaration.js";
-import {
- TokenFamilyCreateSchema as createSchema,
- TokenFamilyUpdateSchema as updateSchema,
-} from "../../schemas/index.js";
+import { TokenFamilyCreateSchema } from "../../schemas/index.js";
import { FormErrors, FormProvider } from "../form/FormProvider.js";
import { Input } from "../form/Input.js";
import { InputWithAddon } from "../form/InputWithAddon.js";
@@ -44,7 +41,7 @@ interface Props {
alreadyExist?: boolean;
}
-export function TokenFamilyForm({ onSubscribe, initial, alreadyExist }: Props) {
+export function TokenFamilyForm({ onSubscribe }: Props) {
const [value, valueHandler] = useState<Partial<Entity>>({
slug: "",
name: "",
@@ -58,10 +55,7 @@ export function TokenFamilyForm({ onSubscribe, initial, alreadyExist }: Props) {
let errors: FormErrors<Entity> = {};
try {
- // (alreadyExist ? updateSchema : createSchema).validateSync(value, {
- // abortEarly: false,
- // });
- createSchema.validateSync(value, {
+ TokenFamilyCreateSchema.validateSync(value, {
abortEarly: false,
});
} catch (err) {
@@ -98,22 +92,18 @@ export function TokenFamilyForm({ onSubscribe, initial, alreadyExist }: Props) {
object={value}
valueHandler={valueHandler}
>
- {/* {alreadyExist ? undefined : ( */}
- <InputWithAddon<Entity>
- name="slug"
- addonBefore={`${backend.url}/tokenfamily/`}
- label={i18n.str`Slug`}
- tooltip={i18n.str`token family slug to use in URLs (for internal use only)`}
- />
- {/* )}
- {alreadyExist ? undefined : ( */}
- <InputSelector<Entity>
- name="kind"
- label={i18n.str`Kind`}
- tooltip={i18n.str`token family kind`}
- values={["discount", "subscription"]}
- />
- {/* )} */}
+ <InputWithAddon<Entity>
+ name="slug"
+ addonBefore={`${backend.url}/tokenfamily/`}
+ label={i18n.str`Slug`}
+ tooltip={i18n.str`token family slug to use in URLs (for internal use only)`}
+ />
+ <InputSelector<Entity>
+ name="kind"
+ label={i18n.str`Kind`}
+ tooltip={i18n.str`token family kind`}
+ values={["discount", "subscription"]}
+ />
<Input<Entity>
name="name"
inputType="text"