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
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();