Added the ability to enable/disable a user as well as deleting an exam
This commit is contained in:
@@ -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};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user