26 lines
670 B
TypeScript
26 lines
670 B
TypeScript
import type { PageLoad } from "./$types";
|
|
|
|
import { superValidate } from "sveltekit-superforms";
|
|
|
|
import { ZUrlEntityId } from "$lib/shared/model/validation";
|
|
import { trpc } from "$lib/shared/trpc";
|
|
import { loadWrap } from "$lib/shared/util";
|
|
|
|
import { SchemaNewExecution } from "./schema";
|
|
|
|
export const load: PageLoad = async (event) => {
|
|
const entry = await loadWrap(async () => {
|
|
const id = ZUrlEntityId.parse(event.params.id);
|
|
return trpc(event).entry.get.query(id);
|
|
});
|
|
|
|
const form = await superValidate(
|
|
{
|
|
old_execution_id: entry.execution?.id,
|
|
...entry.execution,
|
|
},
|
|
SchemaNewExecution,
|
|
);
|
|
|
|
return { entry, form };
|
|
};
|