Skip to content

Commit

Permalink
Test enhanced form
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Nov 26, 2024
1 parent f9917bd commit 27fd3e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib/components/forms/EditData.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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" });
Expand Down
7 changes: 6 additions & 1 deletion src/routes/(app)/documents/[id]-[slug]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 27fd3e6

Please sign in to comment.