import { QueryOptions, useQuery } from 'react-query'; import { api } from '.'; //types import { ServicesScreen } from '@/types/services'; const fetchAllServices = async (id: number | undefined) => { if (!id) { return undefined; } return await api.get(`/services/salon/${id}`); }; export const useFetchAllServices = ( id: number | undefined, options?: QueryOptions ) => { return useQuery(['services/salon', id], () => fetchAllServices(id), options); };