Create Unit Conventer

This commit is contained in:
efrilm
2025-09-12 18:49:01 +07:00
parent 40c417ec72
commit 54c7598e7a
7 changed files with 491 additions and 260 deletions
+11
View File
@@ -1,6 +1,7 @@
import { useQuery } from '@tanstack/react-query'
import { Ingredients } from '../../types/services/ingredient'
import { api } from '../api'
import { Ingredient } from '@/types/services/productRecipe'
interface IngredientsQueryParams {
page?: number
@@ -34,3 +35,13 @@ export function useIngredients(params: IngredientsQueryParams = {}) {
}
})
}
export function useIngredientById(id: string) {
return useQuery<Ingredient>({
queryKey: ['ingredients', id],
queryFn: async () => {
const res = await api.get(`/ingredients/${id}`)
return res.data.data
}
})
}