From 06ffb8c513e35a5f6ac845af2cfa918e605c5719 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 12 Sep 2024 23:41:33 +0530 Subject: [PATCH] feat: schedule api --- src/api/storage.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/api/storage.ts b/src/api/storage.ts index 93e99212..05ff2cb6 100644 --- a/src/api/storage.ts +++ b/src/api/storage.ts @@ -1,6 +1,7 @@ import { default as axios } from "axios"; import { WorkflowFile } from "maxun-core"; import { RunSettings } from "../components/molecules/RunSettings"; +import { ScheduleSettings } from "../components/molecules/ScheduleSettings"; import { CreateRunResponse } from "../pages/MainPage"; export const getStoredRecordings = async (): Promise => { @@ -117,4 +118,18 @@ export const notifyAboutAbort = async (fileName: string, runId:string): Promise< } } - +export const scheduleStoredRecording = async (fileName: string, settings: RunSettings): Promise => { + try { + const response = await axios.put( + `http://localhost:8080/storage/schedule/${fileName}`, + {...settings}); + if (response.status === 200) { + return response.data; + } else { + throw new Error(`Couldn't schedule recording ${fileName}. Please try again later.`); + } + } catch(error: any) { + console.log(error); + return {browserId: '', runId: ''}; + } +}