feat(frontend): add delete option for clips

This commit is contained in:
2026-06-20 13:02:47 +01:00
parent 91c3259331
commit 85d6f568db
3 changed files with 110 additions and 24 deletions

View File

@@ -253,13 +253,27 @@ const getVideoBlob = async(id: string): Promise<Blob> => {
}
}
const isThumbnailAvailable = async (id: number): Promise<boolean> => {
const response = await fetch(API_URL + `/api/v1/download/thumbnail/${id}`, {credentials: "include"});
const deleteClip = async (id: number): Promise<void> => {
const response = await fetch(API_URL + `/api/v1/clips/${id}`, {
method: 'DELETE',
credentials: 'include',
});
if (!response.ok) {
return false;
throw new Error(`Failed to delete clip: ${response.status}`);
}
return true;
const result: APIResponse = await response.json();
if (result.status === 'error') {
throw new Error(`Failed to delete clip: ${result.message}`);
}
};
const isThumbnailAvailable = async (id: number): Promise<boolean> => {
const response = await fetch(API_URL + `/api/v1/download/thumbnail/${id}`, {credentials: "include"});
return response.ok;
}
export {
@@ -275,5 +289,6 @@ export {
getClips,
getClipById,
getVideoBlob,
deleteClip,
isThumbnailAvailable
};