@@ -46,6 +50,7 @@ export default {
},
data() {
return {
+ catMounted: false,
title: "",
buttonText: "",
create: false,
@@ -57,16 +62,9 @@ export default {
},
};
},
- mounted() {
- this.page = {
- name: "",
- position: 0,
- categories: [],
- };
- },
watch: {
- page() {
- console.log(this.page);
+ catMounted(val) {
+ if (val) this.pushSelected();
},
},
methods: {
@@ -76,6 +74,11 @@ export default {
this.buttonText = parameters.buttonText;
this.title = parameters.title;
this.pageDialog = true;
+
+ if (this.catMounted) this.pushSelected();
+ },
+ pushSelected() {
+ this.$refs.categoryFormSelector.setInit(this.page.categories);
},
async submitForm() {
if (this.create) {
diff --git a/frontend/src/components/Admin/General/HomePageSettings.vue b/frontend/src/components/Admin/General/HomePageSettings.vue
index 30a2b2c18..eeb956dc3 100644
--- a/frontend/src/components/Admin/General/HomePageSettings.vue
+++ b/frontend/src/components/Admin/General/HomePageSettings.vue
@@ -38,7 +38,7 @@
- {{$t('settings.homepage.home-page-sections')}}
+ {{ $t("settings.homepage.home-page-sections") }}
@@ -80,7 +80,7 @@
- {{$t('settings.homepage.all-categories')}}
+ {{ $t("settings.homepage.all-categories") }}
@@ -153,13 +153,12 @@ export default {
},
computed: {
allCategories() {
- return this.$store.getters.getCategories;
+ return this.$store.getters.getAllCategories;
},
},
methods: {
writeLang(val) {
- console.log(val);
this.settings.language = val;
},
deleteCategoryfromDatabase(category) {
diff --git a/frontend/src/components/FormHelpers/CategorySelector.vue b/frontend/src/components/FormHelpers/CategorySelector.vue
index 4bc154a52..390bd60d6 100644
--- a/frontend/src/components/FormHelpers/CategorySelector.vue
+++ b/frontend/src/components/FormHelpers/CategorySelector.vue
@@ -16,7 +16,7 @@
diff --git a/frontend/src/components/UI/CardSection.vue b/frontend/src/components/UI/CardSection.vue
index 3d53ee6a5..82ff6c141 100644
--- a/frontend/src/components/UI/CardSection.vue
+++ b/frontend/src/components/UI/CardSection.vue
@@ -2,8 +2,8 @@
-
-
+
+
{{ title.toUpperCase() }}
@@ -92,18 +92,13 @@ export default {
default: false,
},
title: {
- default: null
+ default: null,
},
recipes: Array,
cardLimit: {
default: 999,
},
},
- watch: {
- recipes(val) {
- console.log(val)
- }
- },
computed: {
viewScale() {
switch (this.$vuetify.breakpoint.name) {
diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js
index a538bed6e..3ee9a449a 100644
--- a/frontend/src/store/index.js
+++ b/frontend/src/store/index.js
@@ -26,6 +26,7 @@ const store = new Vuex.Store({
recentRecipes: [],
allRecipes: [],
mealPlanCategories: [],
+ allCategories: [],
},
mutations: {
@@ -36,6 +37,9 @@ const store = new Vuex.Store({
setMealPlanCategories(state, payload) {
state.mealPlanCategories = payload;
},
+ setAllCategories(state, payload) {
+ state.allCategories = payload;
+ },
},
actions: {
@@ -52,11 +56,16 @@ const store = new Vuex.Store({
this.commit("setRecentRecipes", payload);
},
+ async requestCategories({ commit }) {
+ const categories = await api.categories.getAll();
+ commit("setAllCategories", categories);
+ },
},
getters: {
getRecentRecipes: state => state.recentRecipes,
getMealPlanCategories: state => state.mealPlanCategories,
+ getAllCategories: state => state.allCategories,
},
});