Added the ability to enable/disable a user as well as deleting an exam

This commit is contained in:
Tiago Ribeiro
2023-10-04 13:39:31 +01:00
parent 29914d3e89
commit 925250d2c5
7 changed files with 123 additions and 22 deletions

View File

@@ -7,13 +7,15 @@ export default function useExams() {
const [isLoading, setIsLoading] = useState(false);
const [isError, setIsError] = useState(false);
useEffect(() => {
const getData = () => {
setIsLoading(true);
axios
.get<Exam[]>("/api/exam")
.then((response) => setExams(response.data))
.finally(() => setIsLoading(false));
}, []);
};
return {exams, isLoading, isError};
useEffect(getData, []);
return {exams, isLoading, isError, reload: getData};
}