From 56ccc1940fe86a98605eb4ddf83d08b62e206aa8 Mon Sep 17 00:00:00 2001 From: "@milesibastos" Date: Mon, 3 Mar 2025 21:45:31 -0300 Subject: [PATCH] feat: enhance registration form submission handling with result notifications and refactor submit action --- src/routes/[[locale]]/register/+page.svelte | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/routes/[[locale]]/register/+page.svelte b/src/routes/[[locale]]/register/+page.svelte index c9a11fcb..29ce0bdc 100644 --- a/src/routes/[[locale]]/register/+page.svelte +++ b/src/routes/[[locale]]/register/+page.svelte @@ -15,9 +15,23 @@ const form = superForm(data.form, { validators: zodClient(schema), + // Optional: Handle form submission outcomes + onResult: ({ result }) => { + // Handle result as needed (e.g., show a notification) + if (result.type === "success") { + // Handle success + } + }, }); - const { form: formData, enhance } = form; + // Destructure needed form properties + const { form: formData, enhance, submitting, submit } = form; + + // Create a form submission function using SuperForms' built-in submit method + function submitForm() { + // Use the superForm submit method directly + submit(); + }
@@ -95,14 +109,12 @@ - - Submit

También puedes acceder a través de:

- console.debug("ok")} /> +