aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/paths/instance/templates/update/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/templates/update/index.tsx')
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/templates/update/index.tsx8
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/templates/update/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/templates/update/index.tsx
index ba1939914..fc436056a 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/templates/update/index.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/templates/update/index.tsx
@@ -23,6 +23,7 @@ import { HttpStatusCode, TalerErrorDetail, TalerMerchantApi } from "@gnu-taler/t
import {
ErrorType,
HttpError,
+ useMerchantApiContext,
useTranslationContext,
} from "@gnu-taler/web-util/browser";
import { Fragment, VNode, h } from "preact";
@@ -30,11 +31,11 @@ import { useState } from "preact/hooks";
import { Loading } from "../../../../components/exception/loading.js";
import { NotificationCard } from "../../../../components/menu/index.js";
import {
- useTemplateAPI,
useTemplateDetails,
} from "../../../../hooks/templates.js";
import { Notification } from "../../../../utils/types.js";
import { UpdatePage } from "./UpdatePage.js";
+import { useSessionContext } from "../../../../context/session.js";
export type Entity = TalerMerchantApi.TemplatePatchDetails & WithId;
@@ -54,7 +55,8 @@ export default function UpdateTemplate({
onNotFound,
onLoadError,
}: Props): VNode {
- const { updateTemplate } = useTemplateAPI();
+ const { lib } = useMerchantApiContext();
+ const { state } = useSessionContext();
const result = useTemplateDetails(tid);
const [notif, setNotif] = useState<Notification | undefined>(undefined);
@@ -82,7 +84,7 @@ export default function UpdateTemplate({
template={{ ...result.data }}
onBack={onBack}
onUpdate={(data) => {
- return updateTemplate(tid, data)
+ return lib.management.updateTemplate(state.token, tid, data)
.then(onConfirm)
.catch((error) => {
setNotif({