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: ''}; + } +}