mirror of
https://github.com/jcreek/SvelteKitSaasBoilerplate.git
synced 2026-07-12 18:43:50 +00:00
feat(#79): Handle loading state
This commit is contained in:
@@ -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();
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user