import {ClientService} from "../../../client";
import {useQuery} from "@tanstack/react-query";

const useClientsList = () => {
    const {isPending, error, data, refetch} = useQuery({
        queryKey: ['getAllClients'],
        queryFn: ClientService.getAllClients
    });
    const clients = isPending || error || !data ? [] : data.clients;

    return {clients, refetch}
}
export default useClientsList;