import { ExerciceAPIService } from "@/api/services/exercice/exercice.service.api"; import WorkoutPresentationComponent from "@/components/WorkoutPresentationComponent"; import { useRouter } from "expo-router"; import React, { useEffect, useState } from "react"; import { ActivityIndicator, Text, View } from "react-native"; const service = new ExerciceAPIService(); export default function WorkoutScreen() { const router = useRouter(); const [exercices, setExercices] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); useEffect(() => { const loadExercices = async () => { try { const data = await service.getExercices(); setExercices(data); } catch (err: any) { setError(err.message); } finally { setLoading(false); } }; loadExercices(); }, []); if (loading) { return ( ); } if (error) { return ( {error} ); } const workout = exercices[1]; // Choisis l’exercice que tu souhaites afficher return ( ); }