From c3125a0db1051cd87d82d282f8b5b37fa9774063 Mon Sep 17 00:00:00 2001 From: Josh Creek <8179928+jcreek@users.noreply.github.com> Date: Sun, 10 Nov 2024 19:58:50 +0000 Subject: [PATCH] feat(#79): Handle loading state --- src/routes/contact/+page.svelte | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/routes/contact/+page.svelte b/src/routes/contact/+page.svelte index 3ad77a8..ef2e5a8 100644 --- a/src/routes/contact/+page.svelte +++ b/src/routes/contact/+page.svelte @@ -8,13 +8,17 @@ let submitted = false; let error = ''; - const handleSubmit: SubmitFunction = ({}) => { + const handleSubmit: SubmitFunction = () => { + let loading = false; return async ({ result, update }) => { + loading = true; if (result.data && result.data.success) { submitted = true; } else { error = result.error?.message || 'Form submission failed'; } + loading = false; + await update(); }; };