mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-09 03:04:54 -04:00
move api calls to created event (#559)
Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
parent
71a5de3432
commit
d272784469
@ -48,32 +48,16 @@ export default {
|
||||
},
|
||||
},
|
||||
|
||||
async mounted() {
|
||||
async created() {
|
||||
// Initial API Requests
|
||||
this.$store.dispatch("initTheme");
|
||||
this.$store.dispatch("requestRecentRecipes");
|
||||
this.$store.dispatch("refreshToken");
|
||||
this.$store.dispatch("requestCurrentGroup");
|
||||
this.$store.dispatch("requestUserData");
|
||||
this.$store.dispatch("requestCategories");
|
||||
this.$store.dispatch("requestCurrentGroup");
|
||||
this.$store.dispatch("requestTags");
|
||||
this.darkModeSystemCheck();
|
||||
this.darkModeAddEventListener();
|
||||
this.$store.dispatch("requestAppInfo");
|
||||
this.$store.dispatch("requestCustomPages");
|
||||
this.$store.dispatch("requestSiteSettings");
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
refreshing: false,
|
||||
registration: null,
|
||||
snackBtnText: "",
|
||||
snackWithBtnText: "",
|
||||
snackWithButtons: false,
|
||||
};
|
||||
},
|
||||
|
||||
created() {
|
||||
// Listen for swUpdated event and display refresh snackbar as required.
|
||||
document.addEventListener("swUpdated", this.showRefreshUI, { once: true });
|
||||
// Refresh all open app tabs when a new service worker is installed.
|
||||
@ -86,6 +70,21 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.darkModeSystemCheck();
|
||||
this.darkModeAddEventListener();
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
refreshing: false,
|
||||
registration: null,
|
||||
snackBtnText: "",
|
||||
snackWithBtnText: "",
|
||||
snackWithButtons: false,
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
// For Later!
|
||||
|
||||
|
@ -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);
|
||||
|
@ -30,7 +30,7 @@ export default {
|
||||
],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
this.selectedItem = this.$store.getters.getActiveLang;
|
||||
},
|
||||
computed: {
|
||||
|
@ -122,7 +122,7 @@ export default {
|
||||
}
|
||||
},
|
||||
},
|
||||
async mounted() {
|
||||
async created() {
|
||||
await this.$store.dispatch("requestCurrentGroup");
|
||||
await this.$store.dispatch("requestAllRecipes");
|
||||
await this.buildMealStore();
|
||||
|
@ -82,7 +82,7 @@ export default {
|
||||
} else return this.$t("settings.backup.partial-backup");
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
this.resetData();
|
||||
this.getAvailableBackups();
|
||||
},
|
||||
|
@ -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: {
|
||||
|
@ -75,7 +75,7 @@ export default {
|
||||
prettyInfo: [],
|
||||
};
|
||||
},
|
||||
async mounted() {
|
||||
async created() {
|
||||
await this.getInfo();
|
||||
},
|
||||
methods: {
|
||||
|
@ -89,7 +89,7 @@ export default {
|
||||
return this.availableBackups.length;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
this.getAvailableBackups();
|
||||
},
|
||||
methods: {
|
||||
|
@ -105,7 +105,7 @@ export default {
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
this.getStatistics();
|
||||
},
|
||||
methods: {
|
||||
|
@ -76,7 +76,7 @@ export default {
|
||||
return this.group.users.length >= 1 ? true : false;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
this.buildData();
|
||||
},
|
||||
methods: {
|
||||
|
@ -54,7 +54,7 @@ export default {
|
||||
},
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
this.reqGroups();
|
||||
},
|
||||
methods: {
|
||||
|
@ -52,7 +52,7 @@ export default {
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
this.getAvailableMigrations();
|
||||
},
|
||||
methods: {
|
||||
|
@ -100,7 +100,7 @@ export default {
|
||||
};
|
||||
},
|
||||
|
||||
mounted() {
|
||||
created() {
|
||||
this.$store.dispatch("requestUserData");
|
||||
},
|
||||
|
||||
|
@ -160,7 +160,7 @@ export default {
|
||||
},
|
||||
},
|
||||
|
||||
async mounted() {
|
||||
async created() {
|
||||
this.getTodaysMeal();
|
||||
await this.$store.dispatch("requestCurrentGroup");
|
||||
this.getSiteSettings();
|
||||
|
@ -189,7 +189,7 @@ export default {
|
||||
},
|
||||
},
|
||||
},
|
||||
async mounted() {
|
||||
async created() {
|
||||
await this.getAllThemes();
|
||||
},
|
||||
methods: {
|
||||
|
@ -138,7 +138,7 @@ export default {
|
||||
},
|
||||
},
|
||||
|
||||
async mounted() {
|
||||
async created() {
|
||||
this.refreshProfile();
|
||||
},
|
||||
|
||||
|
@ -90,7 +90,7 @@ export default {
|
||||
},
|
||||
};
|
||||
},
|
||||
async mounted() {
|
||||
async created() {
|
||||
this.getPages();
|
||||
},
|
||||
methods: {
|
||||
|
@ -154,7 +154,7 @@ export default {
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
this.getOptions();
|
||||
},
|
||||
computed: {
|
||||
|
@ -67,7 +67,7 @@ export default {
|
||||
tagsToAssign: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
this.$store.dispatch("requestAllRecipes");
|
||||
},
|
||||
watch: {
|
||||
|
@ -157,7 +157,7 @@ export default {
|
||||
],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
this.getAllNotifications();
|
||||
},
|
||||
computed: {
|
||||
|
@ -67,7 +67,7 @@ export default {
|
||||
},
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
this.refreshUnorganized();
|
||||
},
|
||||
methods: {
|
||||
|
@ -33,6 +33,11 @@ export default {
|
||||
recipeByCategory: [],
|
||||
};
|
||||
},
|
||||
async created() {
|
||||
await this.$store.dispatch("requestRecentRecipes");
|
||||
await this.buildPage();
|
||||
this.recipeByCategory.sort((a, b) => a.position - b.position);
|
||||
},
|
||||
computed: {
|
||||
siteSettings() {
|
||||
return this.$store.getters.getSiteSettings;
|
||||
@ -41,10 +46,7 @@ export default {
|
||||
return this.$store.getters.getRecentRecipes;
|
||||
},
|
||||
},
|
||||
async mounted() {
|
||||
await this.buildPage();
|
||||
this.recipeByCategory.sort((a, b) => a.position - b.position);
|
||||
},
|
||||
|
||||
methods: {
|
||||
async buildPage() {
|
||||
await this.$store.dispatch("requestSiteSettings");
|
||||
|
@ -101,7 +101,7 @@ export default {
|
||||
plannedMeals: [],
|
||||
editMealPlan: null,
|
||||
}),
|
||||
async mounted() {
|
||||
async created() {
|
||||
this.requestMeals();
|
||||
},
|
||||
methods: {
|
||||
|
@ -45,7 +45,7 @@ export default {
|
||||
mealPlan: {},
|
||||
};
|
||||
},
|
||||
async mounted() {
|
||||
async created() {
|
||||
if (this.mealplanId) {
|
||||
this.mealPlan = await api.mealPlans.getById(this.mealplanId);
|
||||
} else {
|
||||
|
@ -28,7 +28,7 @@ export default {
|
||||
defaultMessage: { details: "site failed to return valid schema" },
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
if (this.$route.query.test_url) {
|
||||
this.getTestData();
|
||||
}
|
||||
|
@ -130,12 +130,13 @@ export default {
|
||||
};
|
||||
},
|
||||
|
||||
async mounted() {
|
||||
await this.getRecipeDetails();
|
||||
|
||||
created() {
|
||||
this.getRecipeDetails();
|
||||
this.jsonEditor = false;
|
||||
this.form = this.$route.query.edit === "true" && this.loggedIn;
|
||||
},
|
||||
|
||||
async mounted() {
|
||||
this.checkPrintRecipe();
|
||||
},
|
||||
|
||||
|
@ -28,7 +28,7 @@ export default {
|
||||
sortedResults: [],
|
||||
};
|
||||
},
|
||||
async mounted() {
|
||||
async created() {
|
||||
if (this.allRecipes.length < 1) {
|
||||
this.loading = true;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ export default {
|
||||
this.getRecipes();
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
this.getRecipes();
|
||||
this.sortedResults = [];
|
||||
},
|
||||
|
@ -58,7 +58,7 @@ export default {
|
||||
},
|
||||
},
|
||||
|
||||
async mounted() {
|
||||
async created() {
|
||||
await this.buildPage();
|
||||
this.render = true;
|
||||
},
|
||||
|
@ -34,7 +34,7 @@ export default {
|
||||
}
|
||||
},
|
||||
},
|
||||
async mounted() {
|
||||
async created() {
|
||||
this.userData = await api.users.getFavorites(this.$route.params.id);
|
||||
this.sortedResults = [];
|
||||
},
|
||||
|
@ -88,7 +88,7 @@ export default {
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
this.$store.dispatch("requestAllRecipes");
|
||||
},
|
||||
computed: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user