move api calls to created event (#559)

Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
Hayden
2021-06-17 19:48:54 -08:00
committed by GitHub
parent 71a5de3432
commit d272784469
31 changed files with 70 additions and 55 deletions

View File

@@ -72,6 +72,13 @@ export default {
selected: [],
};
},
async created() {
if (this.tagSelector) {
this.$store.dispatch("requestTags");
} else {
this.$store.dispatch("requestCategories");
}
},
mounted() {
this.$emit(MOUNTED_EVENT);
this.setInit(this.value);

View File

@@ -30,7 +30,7 @@ export default {
],
};
},
mounted() {
created() {
this.selectedItem = this.$store.getters.getActiveLang;
},
computed: {

View File

@@ -122,7 +122,7 @@ export default {
}
},
},
async mounted() {
async created() {
await this.$store.dispatch("requestCurrentGroup");
await this.$store.dispatch("requestAllRecipes");
await this.buildMealStore();

View File

@@ -82,7 +82,7 @@ export default {
} else return this.$t("settings.backup.partial-backup");
},
},
mounted() {
created() {
this.resetData();
this.getAvailableBackups();
},

View File

@@ -78,15 +78,21 @@ export default {
hideImage: false,
};
},
mounted() {
this.getVersion();
created() {
this.showSidebar = !this.isMobile;
},
watch: {
user() {
this.hideImage = false;
},
isMain(val) {
if (val) {
this.$store.dispatch("requestCustomPages");
} else {
this.getVersion();
}
},
},
computed: {