diff options
author | Sebastian <sebasjm@gmail.com> | 2023-01-27 12:35:10 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-01-27 15:08:24 -0300 |
commit | 1b2b5d62de5888eae895db69cf6ae51dbfddb32b (patch) | |
tree | b705f9692fcbf7bb207d6c3e5734ec1dab678450 /packages/merchant-backoffice-ui/src/hooks/templates.ts | |
parent | 7a3717125f9ed76719167d3a17b86a7e0502ee33 (diff) | |
download | wallet-core-1b2b5d62de5888eae895db69cf6ae51dbfddb32b.tar.xz |
add use-template button
Diffstat (limited to 'packages/merchant-backoffice-ui/src/hooks/templates.ts')
-rw-r--r-- | packages/merchant-backoffice-ui/src/hooks/templates.ts | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/packages/merchant-backoffice-ui/src/hooks/templates.ts b/packages/merchant-backoffice-ui/src/hooks/templates.ts index 672eaf792..3a28b903d 100644 --- a/packages/merchant-backoffice-ui/src/hooks/templates.ts +++ b/packages/merchant-backoffice-ui/src/hooks/templates.ts @@ -62,14 +62,14 @@ export function useTemplateAPI(): TemplateAPI { return res; }; - const createOrder = async ( + const createOrderFromTemplate = async ( templateId: string, data: MerchantBackend.Template.UsingTemplateDetails, ): Promise< HttpResponseOk<MerchantBackend.Template.UsingTemplateResponse> > => { const res = await request<MerchantBackend.Template.UsingTemplateResponse>( - `/private/templates/${templateId}`, + `/templates/${templateId}`, { method: "POST", data, @@ -79,7 +79,7 @@ export function useTemplateAPI(): TemplateAPI { return res; }; - return { createTemplate, updateTemplate, deleteTemplate, createOrder }; + return { createTemplate, updateTemplate, deleteTemplate, createOrderFromTemplate }; } export interface TemplateAPI { @@ -91,7 +91,7 @@ export interface TemplateAPI { data: MerchantBackend.Template.TemplatePatchDetails, ) => Promise<HttpResponseOk<void>>; deleteTemplate: (id: string) => Promise<HttpResponseOk<void>>; - createOrder: ( + createOrderFromTemplate: ( id: string, data: MerchantBackend.Template.UsingTemplateDetails, ) => Promise<HttpResponseOk<MerchantBackend.Template.UsingTemplateResponse>>; @@ -174,10 +174,9 @@ export function useInstanceTemplates( if (afterData.data.templates.length < MAX_RESULT_SIZE) { setPageAfter(pageAfter + 1); } else { - const from = `${ - afterData.data.templates[afterData.data.templates.length - 1] - .template_id - }`; + const from = `${afterData.data.templates[afterData.data.templates.length - 1] + .template_id + }`; if (from && updatePosition) updatePosition(from); } }, |