fix: re-ordering of cookbooks (#5975)

Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
This commit is contained in:
Richard vL
2025-08-29 23:50:09 +02:00
committed by GitHub
parent c17accd82b
commit 9a3303b06c
2 changed files with 21 additions and 7 deletions

View File

@@ -75,7 +75,7 @@
:delay="250"
:delay-on-touch-only="true"
style="width: 100%"
@end="actions.updateOrder(myCookbooks)"
@end="updateAll(myCookbooks)"
>
<v-expansion-panel
v-for="(cookbook, index) in myCookbooks"
@@ -160,7 +160,7 @@ export default defineNuxtComponent({
});
const $auth = useMealieAuth();
const { store: allCookbooks, actions } = useCookbookStore();
const { store: allCookbooks, actions, updateAll } = useCookbookStore();
// Make a local reactive copy of myCookbooks
const myCookbooks = ref<ReadCookBook[]>([]);
@@ -170,7 +170,7 @@ export default defineNuxtComponent({
myCookbooks.value
= cookbooks?.filter(
cookbook => cookbook.householdId === $auth.user.value?.householdId,
) ?? [];
).sort((a, b) => a.position > b.position) ?? [];
},
{ immediate: true },
);
@@ -249,6 +249,9 @@ export default defineNuxtComponent({
createTarget,
createCookbook,
// update
updateAll,
// delete
deleteTarget,
deleteEventHandler,