update food
This commit is contained in:
@@ -2,6 +2,7 @@ import axios from "@/config/axios";
|
||||
import type {
|
||||
CreateFoodType,
|
||||
GetCategoriesResponseType,
|
||||
GetFoodDetailsResponseType,
|
||||
GetFoodsParams,
|
||||
GetFoodsResponseType,
|
||||
} from "../types/Types";
|
||||
@@ -18,6 +19,18 @@ export const getFoods = async (
|
||||
return data;
|
||||
};
|
||||
|
||||
export const getFoodDetails = async (
|
||||
id: string
|
||||
): Promise<GetFoodDetailsResponseType> => {
|
||||
const { data } = await axios.get<GetFoodDetailsResponseType>(`/foods/${id}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const updateFood = async (id: string, params: CreateFoodType) => {
|
||||
const { data } = await axios.patch(`/foods/${id}`, params);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const getCategories = async (): Promise<GetCategoriesResponseType> => {
|
||||
const { data } = await axios.get<GetCategoriesResponseType>(`/categories`);
|
||||
return data;
|
||||
|
||||
Reference in New Issue
Block a user