diff --git a/src/components/meals/EditMealPage.vue b/src/components/meals/EditMealPage.vue index f5c53b1..4e6a79d 100644 --- a/src/components/meals/EditMealPage.vue +++ b/src/components/meals/EditMealPage.vue @@ -2,6 +2,11 @@
| Chefs | |
| Consumers | |
| Cleanup |
@@ -43,13 +48,14 @@ import data from '@/data.js' import RecipeSearchBox from '@/components/recipes/RecipeSearchBox.vue'; import RecipeCard from '@/components/recipes/RecipeCard.vue'; +import CompactParsedIngredient from '@/components/ingredients/CompactParsedIngredient.vue'; import DatePicker from './DatePicker.vue'; import IngredientAddBox from './IngredientAddBox.vue'; -import CompactParsedIngredient from '@/components/ingredients/CompactParsedIngredient.vue'; +import PersonList from './PersonList.vue'; export default { props: ['id'], - components: { RecipeSearchBox, DatePicker, RecipeCard, IngredientAddBox, CompactParsedIngredient }, + components: { RecipeSearchBox, DatePicker, RecipeCard, IngredientAddBox, CompactParsedIngredient, PersonList }, data() { return { meal: { @@ -96,6 +102,12 @@ export default { deleteIngredient(ingredient) { this.meal.extra_ingredients = this.meal.extra_ingredients.filter(i => i != ingredient); }, + removePerson(list, person) { + this.meal[list] = this.meal[list].filter(p => p.id !== person.id); + }, + addPerson(list, person) { + this.meal[list].push(person); + }, async saveMeal() { const meal = await data.saveMeal(this.meal); if (meal?.id) { @@ -111,6 +123,21 @@ export default { + + \ No newline at end of file diff --git a/src/data.js b/src/data.js index 1951a60..3898399 100644 --- a/src/data.js +++ b/src/data.js @@ -122,5 +122,9 @@ export default { credentials: "include", }); return await response.json(); - } + }, + async searchPerson(name) { + const response = await fetch(BASE_URL + "/persons?q=" + encodeURIComponent(name)); + return await response.json(); + }, } \ No newline at end of file