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