Skip to content

Commit 12e6833

Browse files
authored
Update AutoForm.vue (#3)
Primary button should disable while the form is submitting to prevent duplicate submits.
1 parent fe9549a commit 12e6833

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/AutoForm.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</div>
8181
<div class="flex justify-end">
8282
<SecondaryButton @click="close" :disabled="loading">Cancel</SecondaryButton>
83-
<PrimaryButton class="ml-4" :disabled="allowSubmit ? !allowSubmit(model) : false">{{ submitLabel }}</PrimaryButton>
83+
<PrimaryButton class="ml-4" :disabled="loading || (allowSubmit ? !allowSubmit(model) : false)">{{ submitLabel }}</PrimaryButton>
8484
<slot name="rightbuttons" :instance="getCurrentInstance()?.exposed" :model="model"></slot>
8585
</div>
8686
</div>
@@ -279,4 +279,4 @@ function close() {
279279
const globalKeyHandler = (e:KeyboardEvent) => { if (e.key === 'Escape') close() }
280280
onMounted(() => window.addEventListener('keydown', globalKeyHandler))
281281
onUnmounted(() => window.removeEventListener('keydown', globalKeyHandler))
282-
</script>
282+
</script>

0 commit comments

Comments
 (0)