aboutsummaryrefslogtreecommitdiff
path: root/src/routes
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-07-28 21:30:22 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-07-28 21:33:42 +0200
commit501c16beab78c2640766a60f2c32a6c597f11f37 (patch)
tree39acbd2fd085cc15fc21139ce32b9c43545b8bbc /src/routes
parent962b56b4384e087924927ba9a862bbcd5bda3244 (diff)
fix: adding a ref no longer triggers the Enregistré timeout
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/grocery/[id]/+page.server.ts6
-rw-r--r--src/routes/grocery/[id]/+page.svelte2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/routes/grocery/[id]/+page.server.ts b/src/routes/grocery/[id]/+page.server.ts
index d06c810..e1e2751 100644
--- a/src/routes/grocery/[id]/+page.server.ts
+++ b/src/routes/grocery/[id]/+page.server.ts
@@ -65,7 +65,7 @@ export const actions: Actions = {
}
await addRef(groceryId, reference, price, unit, qualityScore);
- return { success: true };
+ return { success: true, type: 'add' as const };
},
delete: async ({ request }) => {
@@ -76,7 +76,7 @@ export const actions: Actions = {
} catch {
return fail(400, { error: 'ID invalide' });
}
- return { success: true };
+ return { success: true, type: 'delete' as const };
},
update: async ({ request, params }) => {
@@ -91,7 +91,7 @@ export const actions: Actions = {
}
await updateGrocery(groceryId, name, categoryId);
- return { success: true };
+ return { success: true, type: 'update' as const };
},
deleteItem: async ({ params, request }) => {
diff --git a/src/routes/grocery/[id]/+page.svelte b/src/routes/grocery/[id]/+page.svelte
index 1aa28b4..50c2e0a 100644
--- a/src/routes/grocery/[id]/+page.svelte
+++ b/src/routes/grocery/[id]/+page.svelte
@@ -7,7 +7,7 @@
let saved = $state(false);
$effect(() => {
- if (form?.success) {
+ if (form?.success && form?.type === 'update') {
saved = true;
const t = setTimeout(() => (saved = false), 2000);
return () => clearTimeout(t);