diff --git a/src/api/storage.ts b/src/api/storage.ts index 295f340c..074e3e2d 100644 --- a/src/api/storage.ts +++ b/src/api/storage.ts @@ -154,6 +154,27 @@ export const editRecordingFromStorage = async (browserId: string, id: string): P } }; +export interface CreateRunResponseWithQueue extends CreateRunResponse { + queued?: boolean; +} + +export const createAndRunRecording = async (id: string, settings: RunSettings): Promise => { + try { + const response = await axios.put( + `${apiUrl}/robot/runs/${id}`, + { ...settings, withCredentials: true } + ); + if (response.status === 200) { + return response.data; + } else { + throw new Error(`Couldn't create and run recording ${id}`); + } + } catch (error: any) { + console.log(error); + return { browserId: '', runId: '', robotMetaId: '', queued: false }; + } +} + export const createRunForStoredRecording = async (id: string, settings: RunSettings): Promise => { try { const response = await axios.put(