feat: add duplicate recording api

This commit is contained in:
RohitR311
2024-11-17 14:05:52 +05:30
parent 3b210b75ba
commit 4ba986aaf7

View File

@@ -33,6 +33,22 @@ export const updateRecording = async (id: string, data: { name?: string; limit?:
}
};
export const duplicateRecording = async (id: string, targetUrl: string): Promise<any> => {
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<string[] | null> => {
try {
const response = await axios.get(`${apiUrl}/storage/runs`);