ingredient from string API

This commit is contained in:
vabene1111
2024-12-04 18:21:19 +01:00
parent d7487c6d5c
commit b9f49cad45
3 changed files with 35 additions and 7 deletions

View File

@@ -269,8 +269,8 @@ function addIngredient() {
api.apiIngredientFromStringCreate({ingredientString: {text: ingredientInput.value} as IngredientString}).then(r => {
useShoppingStore().createObject({
amount: Math.max(r.amount, 1),
unit: (r.unit != null) ? {name: r.unit} as Unit : null,
food: {name: r.food} as Food,
unit: r.unit,
food: r.food,
} as ShoppingListEntry, true)
ingredientInput.value = ''