diff --git a/vue/src/apps/TestView/TestView.vue b/vue/src/apps/TestView/TestView.vue index 14ade0c4..4f780be6 100644 --- a/vue/src/apps/TestView/TestView.vue +++ b/vue/src/apps/TestView/TestView.vue @@ -1,52 +1,103 @@ @@ -58,6 +109,8 @@ import {BootstrapVue} from "bootstrap-vue" import "bootstrap-vue/dist/bootstrap-vue.css" import {ApiApiFactory} from "@/utils/openapi/api"; import RecipeCard from "@/components/RecipeCard.vue"; +import GenericMultiselect from "@/components/GenericMultiselect.vue"; +import {ApiMixin, StandardToasts} from "@/utils/utils"; Vue.use(BootstrapVue) @@ -65,45 +118,38 @@ Vue.use(BootstrapVue) export default { name: "TestView", - mixins: [], - components: {RecipeCard}, + mixins: [ApiMixin], + components: { + GenericMultiselect + }, data() { return { - recipe: undefined, - recipe_detailed: false, - meal_plan: undefined + food: undefined, + } }, mounted() { this.$i18n.locale = window.CUSTOM_LOCALE let apiClient = new ApiApiFactory() - apiClient.retrieveRecipe('119').then((r) => { - this.recipe = r.data - }) - apiClient.retrieveMealPlan('1').then((r) => { - this.meal_plan = r.data + apiClient.retrieveFood('1').then((r) => { + this.food = r.data }) + + }, + methods: { + updateFood: function () { + let apiClient = new ApiApiFactory() + apiClient.updateFood(this.food.id, this.food).then((r) => { + this.food = r.data + StandardToasts.makeStandardToast(this, StandardToasts.SUCCESS_UPDATE) + }).catch(err => { + StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err) + }) + } }, - methods: {}, }