fix(frontend): Error Boundary, HomePage error state, HLS catch — quick wins pre-Bloc-B
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user