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

const useServicesList = () => {
    const {isPending, error, data, refetch} = useQuery({
        queryKey: ['getAllServices'],
        queryFn: ServiceService.getAllServices
    });
    const services = isPending || error || !data ? [] : data.services;

    return {services, refetch}
}
export default useServicesList;