diff --git a/vue/src/components/Buttons/RecipeSwitcher.vue b/vue/src/components/Buttons/RecipeSwitcher.vue
index be8b0e9e7..922ce208e 100644
--- a/vue/src/components/Buttons/RecipeSwitcher.vue
+++ b/vue/src/components/Buttons/RecipeSwitcher.vue
@@ -25,7 +25,7 @@
{{ r.name }}
+ ">{{ r.name }} x
@@ -38,6 +38,16 @@
">{{ r.name }}
+
+ TEST
+
+
+ {{ r.name }}
+
+
@@ -60,7 +70,8 @@ export default {
related_recipes: [],
planned_recipes: [],
pinned_recipes: [],
- recipes: {}
+ recipes: {},
+ test : []
}
},
computed: {
@@ -84,7 +95,7 @@ export default {
navRecipe: function (recipe) {
if (this.is_recipe_view) {
- this.$emit("switch", this.recipes[recipe.id])
+ this.$emit("switch", recipe)
} else {
window.location.href = this.resolveDjangoUrl("view_recipe", recipe.id)
}
@@ -93,16 +104,23 @@ export default {
let apiClient = new ApiApiFactory()
let recipe_list = [...this.related_recipes, ...this.planned_recipes, ...this.pinned_recipes]
+
let recipe_ids = []
recipe_list.forEach((recipe) => {
- if (!recipe_ids.includes(recipe.id)) {
- recipe_ids.push(recipe.id)
+ let id = recipe.id
+ if (id === undefined){
+ id = recipe
+ }
+
+ if (!recipe_ids.includes(id)) {
+ recipe_ids.push(id)
}
})
-
+ console.log(recipe_list, recipe_ids)
recipe_ids.forEach((id) => {
apiClient.retrieveRecipe(id).then((result) => {
this.recipes[id] = result.data
+ this.test.push(result.data)
})
})
@@ -111,12 +129,14 @@ export default {
let apiClient = new ApiApiFactory()
// get related recipes and save them for later
- return apiClient.relatedRecipe(this.recipe, {query: {levels: 2}}).then((result) => {
- this.related_recipes = result.data
- })
+ if (this.recipe){
+ return apiClient.relatedRecipe(this.recipe, {query: {levels: 2}}).then((result) => {
+ this.related_recipes = result.data
+ })
+ }
},
loadPinnedRecipes: function () {
- let pinned_recipe_ids = localStorage.getItem('pinned_recipes') || []
+ let pinned_recipe_ids = JSON.parse(localStorage.getItem('pinned_recipes')) || []
this.pinned_recipes = pinned_recipe_ids
},
loadMealPlans: function () {
diff --git a/vue/src/components/RecipeContextMenu.vue b/vue/src/components/RecipeContextMenu.vue
index 7cd24e5e3..11b75b582 100644
--- a/vue/src/components/RecipeContextMenu.vue
+++ b/vue/src/components/RecipeContextMenu.vue
@@ -1,38 +1,60 @@
@@ -44,10 +66,17 @@
@@ -62,12 +91,12 @@
:allow_delete="false"
:modal_title="$t('Create_Meal_Plan_Entry')"
>
-
+