aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/components/tokenfamily/TokenFamilyForm.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/merchant-backoffice-ui/src/components/tokenfamily/TokenFamilyForm.tsx')
-rw-r--r--packages/merchant-backoffice-ui/src/components/tokenfamily/TokenFamilyForm.tsx12
1 files changed, 6 insertions, 6 deletions
diff --git a/packages/merchant-backoffice-ui/src/components/tokenfamily/TokenFamilyForm.tsx b/packages/merchant-backoffice-ui/src/components/tokenfamily/TokenFamilyForm.tsx
index 95441b9fa..1492beb48 100644
--- a/packages/merchant-backoffice-ui/src/components/tokenfamily/TokenFamilyForm.tsx
+++ b/packages/merchant-backoffice-ui/src/components/tokenfamily/TokenFamilyForm.tsx
@@ -23,8 +23,6 @@ import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h } from "preact";
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 } from "../../schemas/index.js";
import { FormErrors, FormProvider } from "../form/FormProvider.js";
import { Input } from "../form/Input.js";
@@ -32,8 +30,10 @@ import { InputWithAddon } from "../form/InputWithAddon.js";
import { InputDate } from "../form/InputDate.js";
import { InputDuration } from "../form/InputDuration.js";
import { InputSelector } from "../form/InputSelector.js";
+import { useSessionContext } from "../../context/session.js";
+import { TalerMerchantApi } from "@gnu-taler/taler-util";
-type Entity = MerchantBackend.TokenFamilies.TokenFamilyAddDetail;
+type Entity = TalerMerchantApi.TokenFamilyCreateRequest;
interface Props {
onSubscribe: (c?: () => Entity | undefined) => void;
@@ -47,7 +47,7 @@ export function TokenFamilyForm({ onSubscribe }: Props) {
name: "",
description: "",
description_i18n: {},
- kind: "discount",
+ kind: TalerMerchantApi.TokenFamilyKind.Discount,
duration: { d_us: "forever" },
valid_after: { t_s: "never" },
valid_before: { t_s: "never" },
@@ -81,7 +81,7 @@ export function TokenFamilyForm({ onSubscribe }: Props) {
onSubscribe(hasErrors ? undefined : submit);
}, [submit, hasErrors]);
- const backend = useBackendContext();
+ const { state } = useSessionContext();
const { i18n } = useTranslationContext();
return (
@@ -94,7 +94,7 @@ export function TokenFamilyForm({ onSubscribe }: Props) {
>
<InputWithAddon<Entity>
name="slug"
- addonBefore={`${backend.url}/tokenfamily/`}
+ addonBefore={new URL("tokenfamily/", state.backendUrl.href).href}
label={i18n.str`Slug`}
tooltip={i18n.str`token family slug to use in URLs (for internal use only)`}
/>