import { UnitConversion } from '@/types/services/productRecipe'
import { useQuery } from '@tanstack/react-query'
import { api } from '../api'

export function useUnitConverterByIngredient(IngredientId: string) {
  return useQuery<UnitConversion[]>({
    queryKey: ['unit-converters/ingredient', IngredientId],
    queryFn: async () => {
      const res = await api.get(`/unit-converters/ingredient/${IngredientId}`)
      return res.data.data
    }
  })
}
