feat: add duplicate recording api
This commit is contained in:
@@ -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> => {
|
export const getStoredRuns = async (): Promise<string[] | null> => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(`${apiUrl}/storage/runs`);
|
const response = await axios.get(`${apiUrl}/storage/runs`);
|
||||||
|
|||||||
Reference in New Issue
Block a user