From 27fd3e6e956041f52b7635243fef885101ca79f0 Mon Sep 17 00:00:00 2001 From: Allan Lasser Date: Tue, 26 Nov 2024 14:58:09 -0500 Subject: [PATCH] Test enhanced form --- src/lib/components/forms/EditData.svelte | 1 + src/routes/(app)/documents/[id]-[slug]/+page.server.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/components/forms/EditData.svelte b/src/lib/components/forms/EditData.svelte index cc40df73c..d8870d040 100644 --- a/src/lib/components/forms/EditData.svelte +++ b/src/lib/components/forms/EditData.svelte @@ -54,6 +54,7 @@ // `update` is a function which triggers the default logic that would be triggered if this callback wasn't set dispatch("close"); update(result); + console.log(result); if (result.type === "success") { // do something toast($_("edit.success"), { status: "success" }); diff --git a/src/routes/(app)/documents/[id]-[slug]/+page.server.ts b/src/routes/(app)/documents/[id]-[slug]/+page.server.ts index 248c6f1f2..cd118fe37 100644 --- a/src/routes/(app)/documents/[id]-[slug]/+page.server.ts +++ b/src/routes/(app)/documents/[id]-[slug]/+page.server.ts @@ -7,6 +7,7 @@ import { CSRF_COOKIE_NAME } from "@/config/config.js"; import { destroy, edit, redact } from "$lib/api/documents"; import * as notes from "$lib/api/notes"; import { isErrorCode } from "$lib/utils/api"; +import { setFlash } from "sveltekit-flash-message/server"; export function load({ cookies }) { const csrf_token = cookies.get(CSRF_COOKIE_NAME); @@ -54,12 +55,16 @@ export const actions = { ); if (error) { + setFlash({ message: error.message, status: "error" }, cookies); return fail(error.status, { message: error.message, error: error.errors, }); } - + setFlash( + { message: "Document metadata saved", status: "success" }, + cookies, + ); return { success: true, document,