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

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

    return {categories, refetch}
}

export default useServiceCategoriesList;