1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-20 21:59:40 +02:00
mealie/frontend/api/class-interfaces/recipe-foods.ts

21 lines
608 B
TypeScript
Raw Normal View History

import { BaseCRUDAPI } from "../_base";
import { CreateIngredientFood, IngredientFood } from "~/types/api-types/recipe";
const prefix = "/api";
const routes = {
food: `${prefix}/foods`,
foodsFood: (tag: string) => `${prefix}/foods/${tag}`,
merge: `${prefix}/foods/merge`,
};
2022-05-21 21:22:02 +02:00
export class FoodAPI extends BaseCRUDAPI<CreateIngredientFood, IngredientFood> {
baseRoute: string = routes.food;
itemRoute = routes.foodsFood;
merge(fromId: string, toId: string) {
// @ts-ignore TODO: fix this
return this.requests.put<IngredientFood>(routes.merge, { fromFood: fromId, toFood: toId });
}
}