mirror of
https://github.com/bartvdbraak/omnidash.git
synced 2025-05-03 18:21:20 +00:00
25 lines
639 B
TypeScript
25 lines
639 B
TypeScript
import { superValidate } from "sveltekit-superforms";
|
|
import { zod } from "sveltekit-superforms/adapters";
|
|
import type { PageServerLoad } from "../$types";
|
|
import { notificationsFormSchema } from "./notifications-form.svelte";
|
|
import { fail, type Actions } from "@sveltejs/kit";
|
|
|
|
export const load: PageServerLoad = async () => {
|
|
return {
|
|
form: await superValidate(zod(notificationsFormSchema)),
|
|
};
|
|
};
|
|
|
|
export const actions: Actions = {
|
|
default: async (event) => {
|
|
const form = await superValidate(event, zod(notificationsFormSchema));
|
|
if (!form.valid) {
|
|
return fail(400, {
|
|
form,
|
|
});
|
|
}
|
|
return {
|
|
form,
|
|
};
|
|
},
|
|
};
|