From 3bd637fc560d64ac990ebdc45d0e3c4d5f16566f Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 17 May 2022 15:49:53 +0200 Subject: [PATCH] js: add estimateFillDuration query --- .../components/TypesDeChampEditor/operations.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/javascript/components/TypesDeChampEditor/operations.ts b/app/javascript/components/TypesDeChampEditor/operations.ts index 3fbcdff18..aefb4cc03 100644 --- a/app/javascript/components/TypesDeChampEditor/operations.ts +++ b/app/javascript/components/TypesDeChampEditor/operations.ts @@ -52,8 +52,20 @@ export function updateTypeDeChampOperation( handleResponseData(typeDeChamp, data as ResponseData); }); } +export function estimateFillDuration(queue: OperationsQueue): Promise { + return queue + .enqueue({ + path: `/estimate_fill_duration`, + method: 'get' + }) + .then((data) => { + const responseData = data as EstimatedFillDurationResponseData; + return responseData.estimated_fill_duration; + }); +} type ResponseData = { type_de_champ: Record }; +type EstimatedFillDurationResponseData = { estimated_fill_duration: number }; function handleResponseData( typeDeChamp: Partial,