1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-21 14:19:41 +02:00
mealie/frontend/lib/api/user/recipe-units.ts

21 lines
618 B
TypeScript
Raw Normal View History

import { BaseCRUDAPI } from "../base/base-clients";
import { CreateIngredientUnit, IngredientUnit } from "~/lib/api/types/recipe";
const prefix = "/api";
const routes = {
unit: `${prefix}/units`,
unitsUnit: (tag: string) => `${prefix}/units/${tag}`,
2022-04-09 19:57:49 -08:00
merge: `${prefix}/units/merge`,
};
2022-05-21 21:22:02 +02:00
export class UnitAPI extends BaseCRUDAPI<CreateIngredientUnit, IngredientUnit> {
baseRoute: string = routes.unit;
itemRoute = routes.unitsUnit;
2022-04-09 19:57:49 -08:00
merge(fromId: string, toId: string) {
// @ts-ignore TODO: fix this
return this.requests.put<IngredientUnit>(routes.merge, { fromUnit: fromId, toUnit: toId });
}
}