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("initTheme");
|
||||||
this.$store.dispatch("requestRecentRecipes");
|
|
||||||
this.$store.dispatch("refreshToken");
|
this.$store.dispatch("refreshToken");
|
||||||
this.$store.dispatch("requestCurrentGroup");
|
|
||||||
this.$store.dispatch("requestUserData");
|
this.$store.dispatch("requestUserData");
|
||||||
this.$store.dispatch("requestCategories");
|
this.$store.dispatch("requestCurrentGroup");
|
||||||
this.$store.dispatch("requestTags");
|
this.$store.dispatch("requestTags");
|
||||||
this.darkModeSystemCheck();
|
|
||||||
this.darkModeAddEventListener();
|
|
||||||
this.$store.dispatch("requestAppInfo");
|
this.$store.dispatch("requestAppInfo");
|
||||||
this.$store.dispatch("requestCustomPages");
|
|
||||||
this.$store.dispatch("requestSiteSettings");
|
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.
|
// Listen for swUpdated event and display refresh snackbar as required.
|
||||||
document.addEventListener("swUpdated", this.showRefreshUI, { once: true });
|
document.addEventListener("swUpdated", this.showRefreshUI, { once: true });
|
||||||
// Refresh all open app tabs when a new service worker is installed.
|
// 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: {
|
methods: {
|
||||||
// For Later!
|
// For Later!
|
||||||
|
|
||||||
|
@ -72,6 +72,13 @@ export default {
|
|||||||
selected: [],
|
selected: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
async created() {
|
||||||
|
if (this.tagSelector) {
|
||||||
|
this.$store.dispatch("requestTags");
|
||||||
|
} else {
|
||||||
|
this.$store.dispatch("requestCategories");
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$emit(MOUNTED_EVENT);
|
this.$emit(MOUNTED_EVENT);
|
||||||
this.setInit(this.value);
|
this.setInit(this.value);
|
||||||
|
@ -30,7 +30,7 @@ export default {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
this.selectedItem = this.$store.getters.getActiveLang;
|
this.selectedItem = this.$store.getters.getActiveLang;
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -122,7 +122,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
async mounted() {
|
async created() {
|
||||||
await this.$store.dispatch("requestCurrentGroup");
|
await this.$store.dispatch("requestCurrentGroup");
|
||||||
await this.$store.dispatch("requestAllRecipes");
|
await this.$store.dispatch("requestAllRecipes");
|
||||||
await this.buildMealStore();
|
await this.buildMealStore();
|
||||||
|
@ -82,7 +82,7 @@ export default {
|
|||||||
} else return this.$t("settings.backup.partial-backup");
|
} else return this.$t("settings.backup.partial-backup");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
this.resetData();
|
this.resetData();
|
||||||
this.getAvailableBackups();
|
this.getAvailableBackups();
|
||||||
},
|
},
|
||||||
|
@ -78,15 +78,21 @@ export default {
|
|||||||
hideImage: false,
|
hideImage: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
this.getVersion();
|
|
||||||
|
|
||||||
this.showSidebar = !this.isMobile;
|
this.showSidebar = !this.isMobile;
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
user() {
|
user() {
|
||||||
this.hideImage = false;
|
this.hideImage = false;
|
||||||
},
|
},
|
||||||
|
isMain(val) {
|
||||||
|
if (val) {
|
||||||
|
this.$store.dispatch("requestCustomPages");
|
||||||
|
} else {
|
||||||
|
this.getVersion();
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -75,7 +75,7 @@ export default {
|
|||||||
prettyInfo: [],
|
prettyInfo: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async mounted() {
|
async created() {
|
||||||
await this.getInfo();
|
await this.getInfo();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -89,7 +89,7 @@ export default {
|
|||||||
return this.availableBackups.length;
|
return this.availableBackups.length;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
this.getAvailableBackups();
|
this.getAvailableBackups();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -105,7 +105,7 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
this.getStatistics();
|
this.getStatistics();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -76,7 +76,7 @@ export default {
|
|||||||
return this.group.users.length >= 1 ? true : false;
|
return this.group.users.length >= 1 ? true : false;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
this.buildData();
|
this.buildData();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -54,7 +54,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
this.reqGroups();
|
this.reqGroups();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -52,7 +52,7 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
this.getAvailableMigrations();
|
this.getAvailableMigrations();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -100,7 +100,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
created() {
|
||||||
this.$store.dispatch("requestUserData");
|
this.$store.dispatch("requestUserData");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
async mounted() {
|
async created() {
|
||||||
this.getTodaysMeal();
|
this.getTodaysMeal();
|
||||||
await this.$store.dispatch("requestCurrentGroup");
|
await this.$store.dispatch("requestCurrentGroup");
|
||||||
this.getSiteSettings();
|
this.getSiteSettings();
|
||||||
|
@ -189,7 +189,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
async mounted() {
|
async created() {
|
||||||
await this.getAllThemes();
|
await this.getAllThemes();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -138,7 +138,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
async mounted() {
|
async created() {
|
||||||
this.refreshProfile();
|
this.refreshProfile();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async mounted() {
|
async created() {
|
||||||
this.getPages();
|
this.getPages();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -154,7 +154,7 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
this.getOptions();
|
this.getOptions();
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -67,7 +67,7 @@ export default {
|
|||||||
tagsToAssign: [],
|
tagsToAssign: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
this.$store.dispatch("requestAllRecipes");
|
this.$store.dispatch("requestAllRecipes");
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -157,7 +157,7 @@ export default {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
this.getAllNotifications();
|
this.getAllNotifications();
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -67,7 +67,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
this.refreshUnorganized();
|
this.refreshUnorganized();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -33,6 +33,11 @@ export default {
|
|||||||
recipeByCategory: [],
|
recipeByCategory: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
async created() {
|
||||||
|
await this.$store.dispatch("requestRecentRecipes");
|
||||||
|
await this.buildPage();
|
||||||
|
this.recipeByCategory.sort((a, b) => a.position - b.position);
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
siteSettings() {
|
siteSettings() {
|
||||||
return this.$store.getters.getSiteSettings;
|
return this.$store.getters.getSiteSettings;
|
||||||
@ -41,10 +46,7 @@ export default {
|
|||||||
return this.$store.getters.getRecentRecipes;
|
return this.$store.getters.getRecentRecipes;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
async mounted() {
|
|
||||||
await this.buildPage();
|
|
||||||
this.recipeByCategory.sort((a, b) => a.position - b.position);
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
async buildPage() {
|
async buildPage() {
|
||||||
await this.$store.dispatch("requestSiteSettings");
|
await this.$store.dispatch("requestSiteSettings");
|
||||||
|
@ -101,7 +101,7 @@ export default {
|
|||||||
plannedMeals: [],
|
plannedMeals: [],
|
||||||
editMealPlan: null,
|
editMealPlan: null,
|
||||||
}),
|
}),
|
||||||
async mounted() {
|
async created() {
|
||||||
this.requestMeals();
|
this.requestMeals();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -45,7 +45,7 @@ export default {
|
|||||||
mealPlan: {},
|
mealPlan: {},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async mounted() {
|
async created() {
|
||||||
if (this.mealplanId) {
|
if (this.mealplanId) {
|
||||||
this.mealPlan = await api.mealPlans.getById(this.mealplanId);
|
this.mealPlan = await api.mealPlans.getById(this.mealplanId);
|
||||||
} else {
|
} else {
|
||||||
|
@ -28,7 +28,7 @@ export default {
|
|||||||
defaultMessage: { details: "site failed to return valid schema" },
|
defaultMessage: { details: "site failed to return valid schema" },
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
if (this.$route.query.test_url) {
|
if (this.$route.query.test_url) {
|
||||||
this.getTestData();
|
this.getTestData();
|
||||||
}
|
}
|
||||||
|
@ -130,12 +130,13 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
async mounted() {
|
created() {
|
||||||
await this.getRecipeDetails();
|
this.getRecipeDetails();
|
||||||
|
|
||||||
this.jsonEditor = false;
|
this.jsonEditor = false;
|
||||||
this.form = this.$route.query.edit === "true" && this.loggedIn;
|
this.form = this.$route.query.edit === "true" && this.loggedIn;
|
||||||
|
},
|
||||||
|
|
||||||
|
async mounted() {
|
||||||
this.checkPrintRecipe();
|
this.checkPrintRecipe();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ export default {
|
|||||||
sortedResults: [],
|
sortedResults: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async mounted() {
|
async created() {
|
||||||
if (this.allRecipes.length < 1) {
|
if (this.allRecipes.length < 1) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ export default {
|
|||||||
this.getRecipes();
|
this.getRecipes();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
this.getRecipes();
|
this.getRecipes();
|
||||||
this.sortedResults = [];
|
this.sortedResults = [];
|
||||||
},
|
},
|
||||||
|
@ -58,7 +58,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
async mounted() {
|
async created() {
|
||||||
await this.buildPage();
|
await this.buildPage();
|
||||||
this.render = true;
|
this.render = true;
|
||||||
},
|
},
|
||||||
|
@ -34,7 +34,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
async mounted() {
|
async created() {
|
||||||
this.userData = await api.users.getFavorites(this.$route.params.id);
|
this.userData = await api.users.getFavorites(this.$route.params.id);
|
||||||
this.sortedResults = [];
|
this.sortedResults = [];
|
||||||
},
|
},
|
||||||
|
@ -88,7 +88,7 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
this.$store.dispatch("requestAllRecipes");
|
this.$store.dispatch("requestAllRecipes");
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user