fix(frontend): Error Boundary, HomePage error state, HLS catch — quick wins pre-Bloc-B

This commit is contained in:
2026-03-15 00:53:46 +01:00
parent f80b8cb81c
commit df8e594d57
4 changed files with 43 additions and 4 deletions

View File

@@ -19,11 +19,12 @@ interface VideosResponse {
export default function HomePage() {
const [videos, setVideos] = useState<Video[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(false);
useEffect(() => {
apiFetch<VideosResponse>('/videos')
.then((res) => setVideos(res.data.videos))
.catch(() => setVideos([]))
.catch(() => setError(true))
.finally(() => setLoading(false));
}, []);
@@ -47,7 +48,11 @@ export default function HomePage() {
</div>
)}
{!loading && (
{error && (
<p className="text-sm text-od-crit">Impossible de charger les vidéos. Réessaie plus tard.</p>
)}
{!loading && !error && (
<>
{free.length > 0 && (
<section>