import VideoCard from "../components/video/VideoCard"; import { useEffect, useState } from "react"; import { getClips, deleteClip } from "../utils/endpoints"; import type { Clip } from "../utils/types"; const MyClips = () => { const [clips, setClips] = useState([]); const [error, setError] = useState(null); useEffect(() => { getClips() .then(setClips) .catch((err) => setError(err)); }, []); const handleDelete = async (id: number) => { try { await deleteClip(id); setClips(prev => prev.filter(c => c.id !== id)); } catch (err) { setError(err instanceof Error ? err.message : "Failed to delete clip"); } }; return (

My Clips

{clips.map((clip) => ( handleDelete(clip.id)} /> ))}
{clips.length === 0 && !error && (

No clips yet.

Upload your first clip to get started.

)} {error &&

{error.toString()}

}
); } export default MyClips;