Get Recipes Route Rewrite (#339)

* deprecate old route

* auto-gen

* recipe card infinite scroll

* fix datatable

* set hard-limit option

* add loader

* set scroll on navigation

* add auto-import

* fix slow initial load

* remove console.logs

Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
Hayden
2021-04-22 22:13:55 -08:00
committed by GitHub
parent 80f8806604
commit 8e4b951ecc
19 changed files with 128 additions and 73 deletions

View File

@@ -53,19 +53,18 @@ const store = new Vuex.Store({
},
actions: {
async requestRecentRecipes() {
// const keys = [
// "name",
// "slug",
// "image",
// "description",
// "dateAdded",
// "rating",
// ];
const payload = await api.recipes.allSummary();
async requestRecentRecipes({ getters }) {
const payload = await api.recipes.allSummary(0, 30);
const recent = getters.getRecentRecipes;
if (recent.length >= 30) return;
this.commit("setRecentRecipes", payload);
},
async requestAllRecipes({ getters }) {
const recent = getters.getRecentRecipes;
const start = recent.length + 1;
const payload = await api.recipes.allSummary(start, 9999);
this.commit("setRecentRecipes", [...recent, ...payload]);
},
async requestCategories({ commit }) {
const categories = await api.categories.getAll();
commit("setAllCategories", categories);
@@ -74,7 +73,6 @@ const store = new Vuex.Store({
const tags = await api.tags.getAll();
commit("setAllTags", tags);
},
async requestAppInfo({ commit }) {
const response = await api.meta.getAppInfo();
commit("setAppInfo", response);