Added more options to the User List
This commit is contained in:
@@ -7,13 +7,15 @@ export default function useUsers() {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [isError, setIsError] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const getData = () => {
|
||||
setIsLoading(true);
|
||||
axios
|
||||
.get<User[]>("/api/users/list")
|
||||
.then((response) => setUsers(response.data))
|
||||
.finally(() => setIsLoading(false));
|
||||
}, []);
|
||||
};
|
||||
|
||||
return {users, isLoading, isError};
|
||||
useEffect(getData, []);
|
||||
|
||||
return {users, isLoading, isError, reload: getData};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user