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