From 4ba986aaf7c2aee00c6f03c69174121c5e606d56 Mon Sep 17 00:00:00 2001 From: RohitR311 Date: Sun, 17 Nov 2024 14:05:52 +0530 Subject: [PATCH] feat: add duplicate recording api --- src/api/storage.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/api/storage.ts b/src/api/storage.ts index 0ad51e77..90ab91af 100644 --- a/src/api/storage.ts +++ b/src/api/storage.ts @@ -33,6 +33,22 @@ export const updateRecording = async (id: string, data: { name?: string; limit?: } }; +export const duplicateRecording = async (id: string, targetUrl: string): Promise => { + try { + const response = await axios.post(`${apiUrl}/storage/recordings/${id}/duplicate`, { + targetUrl, + }); + if (response.status === 201) { + return response.data; // Returns the duplicated robot details + } else { + throw new Error(`Couldn't duplicate recording with id ${id}`); + } + } catch (error: any) { + console.error(`Error duplicating recording: ${error.message}`); + return null; + } +}; + export const getStoredRuns = async (): Promise => { try { const response = await axios.get(`${apiUrl}/storage/runs`);