add merge funcions for units (#1146)

This commit is contained in:
Hayden authored and GitHub committed 2022-04-09 19:57:49 -08:00
1 parent b93dae109e
commit db095656e1
8 files changed
+172 -25

No files matched your search

@@ -6,9 +6,15 @@ const prefix = "/api";
const routes = {
unit: `${prefix}/units`,
unitsUnit: (tag: string) => `${prefix}/units/${tag}`,
merge: `${prefix}/units/merge`,
};
export class UnitAPI extends BaseCRUDAPI<IngredientUnit, CreateIngredientUnit> {
baseRoute: string = routes.unit;
itemRoute = routes.unitsUnit;
merge(fromId: string, toId: string) {
// @ts-ignore TODO: fix this
return this.requests.put<IngredientUnit>(routes.merge, { fromUnit: fromId, toUnit: toId });
}
}