ADD functionality to retrieve and display clips by ID

This commit is contained in:
2025-07-14 13:36:26 +02:00
parent 5fa4425f1b
commit 416da3281a
6 changed files with 61 additions and 2 deletions

View File

@@ -167,6 +167,23 @@ const getClips = async (setError: Function): Promise< Clip[]> => {
}
}
const getClipById = async (id: string): Promise<Clip | null> => {
try {
const response = await fetch(`/api/v1/clips/${id}`, {credentials: "include",});
if (!response.ok) {
console.error('Failed to fetch clip:', response.status);
return null;
}
const result: APIResponse = await response.json();
return result.data;
} catch (error: unknown) {
console.error('Error fetching clip:', error);
return null;
}
};
export {
uploadFile,
editFile,
@@ -174,5 +191,6 @@ export {
getProgress,
getMetadata,
getUser,
getClips
getClips,
getClipById
};