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