From 2219a9a81adb0cfae7bcfde2a088a18f7bc932b3 Mon Sep 17 00:00:00 2001 From: monsieurswag Date: Mon, 24 Jun 2024 15:48:10 +0200 Subject: [PATCH] Fix non-working delete evidence attachment button Formatter --- .../routes/(app)/evidences/[id=uuid]/+page.server.ts | 5 ++++- .../src/routes/(app)/evidences/[id=uuid]/+page.svelte | 11 ++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/frontend/src/routes/(app)/evidences/[id=uuid]/+page.server.ts b/frontend/src/routes/(app)/evidences/[id=uuid]/+page.server.ts index c059e6780..6ec60f0e9 100644 --- a/frontend/src/routes/(app)/evidences/[id=uuid]/+page.server.ts +++ b/frontend/src/routes/(app)/evidences/[id=uuid]/+page.server.ts @@ -39,7 +39,10 @@ export const load: PageServerLoad = async ({ fetch, params }) => { } } - return { URLModel, evidence, object, tables }; + const schema = z.object({ id: z.string().uuid() }); + const deleteForm = await superValidate(zod(schema)); + + return { URLModel, evidence, object, tables, deleteForm }; }; export const actions: Actions = { diff --git a/frontend/src/routes/(app)/evidences/[id=uuid]/+page.svelte b/frontend/src/routes/(app)/evidences/[id=uuid]/+page.svelte index 7f21481c1..27a97bd56 100644 --- a/frontend/src/routes/(app)/evidences/[id=uuid]/+page.svelte +++ b/frontend/src/routes/(app)/evidences/[id=uuid]/+page.svelte @@ -5,12 +5,7 @@ import { breadcrumbObject } from '$lib/utils/stores'; import { URL_MODEL_MAP } from '$lib/utils/crud'; import ConfirmModal from '$lib/components/Modals/ConfirmModal.svelte'; - import type { - ModalSettings, - ModalComponent, - ModalStore, - ToastStore - } from '@skeletonlabs/skeleton'; + import type { ModalSettings, ModalComponent, ModalStore } from '@skeletonlabs/skeleton'; import { getModalStore, TabGroup, Tab, getToastStore } from '@skeletonlabs/skeleton'; import { isURL } from '$lib/utils/helpers'; import { getModelInfo } from '$lib/utils/crud.js'; @@ -29,15 +24,13 @@ } let attachment: Attachment | undefined = undefined; - const modalStore: ModalStore = getModalStore(); - const toastStore: ToastStore = getToastStore(); function modalConfirm(id: string, name: string, action: string): void { const modalComponent: ModalComponent = { ref: ConfirmModal, props: { - _form: data.evidence.form, + _form: data.deleteForm, id: id, debug: false, URLModel: getModelInfo('evidences').urlModel,