filter category id
This commit is contained in:
@@ -8,6 +8,7 @@ import type {
|
||||
GetFoodsResponseType,
|
||||
GetIconsResponseType,
|
||||
} from "../types/Types";
|
||||
import type { FilterValues } from "@/components/Filters";
|
||||
|
||||
export const createFood = async (params: CreateFoodType) => {
|
||||
const { data } = await axios.post(`/admin/foods`, params);
|
||||
@@ -15,19 +16,23 @@ export const createFood = async (params: CreateFoodType) => {
|
||||
};
|
||||
|
||||
export const getFoods = async (
|
||||
params?: GetFoodsParams
|
||||
params?: GetFoodsParams,
|
||||
filters?: FilterValues,
|
||||
): Promise<GetFoodsResponseType> => {
|
||||
const { data } = await axios.get<GetFoodsResponseType>(`/admin/foods`, {
|
||||
params,
|
||||
params: {
|
||||
...params,
|
||||
...filters,
|
||||
},
|
||||
});
|
||||
return data;
|
||||
};
|
||||
|
||||
export const getFoodDetails = async (
|
||||
id: string
|
||||
id: string,
|
||||
): Promise<GetFoodDetailsResponseType> => {
|
||||
const { data } = await axios.get<GetFoodDetailsResponseType>(
|
||||
`/admin/foods/${id}`
|
||||
`/admin/foods/${id}`,
|
||||
);
|
||||
return data;
|
||||
};
|
||||
@@ -39,7 +44,7 @@ export const updateFood = async (id: string, params: CreateFoodType) => {
|
||||
|
||||
export const getCategories = async (): Promise<GetCategoriesResponseType> => {
|
||||
const { data } = await axios.get<GetCategoriesResponseType>(
|
||||
`/admin/categories`
|
||||
`/admin/categories`,
|
||||
);
|
||||
return data;
|
||||
};
|
||||
@@ -61,7 +66,7 @@ export const deleteCategory = async (id: string) => {
|
||||
|
||||
export const updateCategory = async (
|
||||
id: string,
|
||||
params: CreateCategoryType
|
||||
params: CreateCategoryType,
|
||||
) => {
|
||||
const { data } = await axios.patch(`/admin/categories/${id}`, params);
|
||||
return data;
|
||||
|
||||
Reference in New Issue
Block a user