({ recipes: [], rows: [], uncheckedCount: 0 });
let loading = $state(true);
@@ -16,6 +19,17 @@
}
}
+ async function onToggleRow(row: Row, next: boolean) {
+ const method = next ? 'POST' : 'DELETE';
+ await fetch('/api/shopping-list/check', {
+ method,
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ name_key: row.name_key, unit_key: row.unit_key })
+ });
+ await load();
+ void shoppingCartStore.refresh();
+ }
+
onMount(load);
@@ -36,6 +50,14 @@
Einkaufswagen ist leer.
Lege Rezepte auf der Wunschliste in den Wagen, um sie hier zu sehen.
+{:else}
+
+ {#each snapshot.rows as row (row.name_key + '|' + row.unit_key)}
+ -
+
+
+ {/each}
+
{/if}