I try to implement a form action, but I have some trouble with error handling/validation (nameMissing and emailMissing values would be used for validation)
import { fail } from '@sveltejs/kit'export const actions = { default: async ({ request }) => { const form = await request.formData(); const name = form.get('name'); const email = form.get('email'); console.log(name); console.log(email); if(!name) { return fail(400, {nameMissing: true }) } if(!email) { return fail(400, {emailMissing: true }) } return { success: true } },};
It seems to me, the fail import is not successful, because if I use a console.log in my if, it works.Thanks