1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-25 08:09:41 +02:00

Feature/infinite scroll (#719)

* feat(frontend):  lazy-load all recipes page

* feat(frontend):  enable runtime theme through env-variables

* docs(docs): 📝 update v1 changelog

* bump version

Co-authored-by: Hayden <hay-kot@pm.me>
This commit is contained in:
Hayden 2021-10-03 14:07:18 -08:00 committed by GitHub
parent 568215cf70
commit c0dd07f9e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 548 additions and 281 deletions

View file

@ -57,6 +57,26 @@ export const useSorter = () => {
};
};
export const useLazyRecipes = function () {
const api = useApiSingleton();
const recipes = ref<Recipe[] | null>([]);
async function fetchMore(start: number, limit: number) {
const { data } = await api.recipes.getAll(start, limit);
if (data) {
data.forEach((recipe) => {
recipes.value?.push(recipe);
});
}
}
return {
recipes,
fetchMore,
};
};
export const useRecipes = (all = false, fetchRecipes = true) => {
const api = useApiSingleton();