filter category id

This commit is contained in:
hamid zarghami
2026-02-07 12:39:45 +03:30
parent 1552830e76
commit d9012e524a
5 changed files with 47 additions and 20 deletions
+11 -6
View File
@@ -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;