feat: modify notify abort route

This commit is contained in:
Rohit
2025-06-12 11:17:59 +05:30
parent 9b9bc6dae7
commit 2eb7c4d851

View File

@@ -184,20 +184,24 @@ export const interpretStoredRecording = async (id: string): Promise<boolean> =>
} }
} }
export const notifyAboutAbort = async (id: string): Promise<boolean> => { export const notifyAboutAbort = async (id: string): Promise<{ success: boolean; isQueued?: boolean }> => {
try { try {
const response = await axios.post(`${apiUrl}/storage/runs/abort/${id}`); const response = await axios.post(`${apiUrl}/robot/runs/abort/${id}`, { withCredentials: true });
if (response.status === 200) { if (response.status === 200) {
return response.data; return {
success: response.data.success,
isQueued: response.data.isQueued
};
} else { } else {
throw new Error(`Couldn't abort a running recording with id ${id}`); throw new Error(`Couldn't abort a running recording with id ${id}`);
} }
} catch (error: any) { } catch (error: any) {
console.log(error); console.log(error);
return false; return { success: false };
} }
} }
export const scheduleStoredRecording = async (id: string, settings: ScheduleSettings): Promise<ScheduleRunResponse> => { export const scheduleStoredRecording = async (id: string, settings: ScheduleSettings): Promise<ScheduleRunResponse> => {
try { try {
const response = await axios.put( const response = await axios.put(