stylist / frontend / src / api / useFetchLandingSalons.ts
useFetchLandingSalons.ts
Raw
import { useQuery } from 'react-query';

import { api } from '.';
//types
import { SalonLanding } from '@/types/salon';

const fetchLandingSalons = async () =>
  await api.get<never, SalonLanding[]>('/salons');

export const useFetchLandingSalons = () => {
  return useQuery(['salons'], fetchLandingSalons);
};