You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
625 B
19 lines
625 B
export const useExercices = () => {
|
|
const [exercices, setExercices] = useState([]);
|
|
const [loading, setLoading] = useState(true);
|
|
const [error, setError] = useState(null);
|
|
useEffect(() => {
|
|
const fetchExercices = async () => {
|
|
try {
|
|
const response = await apiClient.get(EXERCICES.GETALL);
|
|
setExercices(response.data);
|
|
setLoading(false);
|
|
} catch (error) {
|
|
setError(error);
|
|
setLoading(false);
|
|
}
|
|
};
|
|
fetchExercices();
|
|
}, []);
|
|
return { exercices, loading, error };
|
|
} |