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

fix: all-recipes page now sorts alphabetically (#1405)

* added sort params to backend call

* hardcoded alphabetical sort param

* removed trivial type annotation

* linters are friends, not food
This commit is contained in:
Michael Genson 2022-06-19 13:03:24 -05:00 committed by GitHub
parent d4b92a8ade
commit bb1fa52d10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View file

@ -22,8 +22,12 @@ import { useLazyRecipes } from "~/composables/recipes";
export default defineComponent({
components: { RecipeCardSection },
setup() {
const start = ref(0);
// paging and sorting params
const orderBy = "name";
const orderDescending = false;
const increment = ref(30);
const start = ref(0);
const offset = ref(increment.value);
const limit = ref(increment.value);
const ready = ref(false);
@ -32,7 +36,7 @@ export default defineComponent({
const { recipes, fetchMore } = useLazyRecipes();
onMounted(async () => {
await fetchMore(start.value, limit.value);
await fetchMore(start.value, limit.value, orderBy, orderDescending);
ready.value = true;
});
@ -43,7 +47,7 @@ export default defineComponent({
loading.value = true;
start.value = offset.value + 1;
offset.value = offset.value + increment.value;
fetchMore(start.value, limit.value);
fetchMore(start.value, limit.value, orderBy, orderDescending);
loading.value = false;
}, 500);