Skip to content

Commit

Permalink
fixed button modal
Browse files Browse the repository at this point in the history
  • Loading branch information
LiveDuo committed Mar 28, 2024
1 parent cb57928 commit 0dfc44f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/client/vanilla/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const Dialog: React.FC<DialogProps> = ({ open, setOpen, selectedElement }) => {
} else if (type === 'submit') {
if (submitAsync) {
const source = `
const e = arguments[0]
const form = e.target.closest('form')
const formData = new FormData()
Expand All @@ -62,7 +63,7 @@ const Dialog: React.FC<DialogProps> = ({ open, setOpen, selectedElement }) => {
}
}
const options = { method: '${submitMethod}', ...('${submitMethod}' !== 'GET' ? { body: formData } : {}), }
const options = { method: '${submitMethod}', body: ${submitMethod !== 'GET' ? 'formData' : 'null'} }
fetch('${submitUrl}', options)
.then((e) => e.text().then((d) => ({ ok: e.ok, text: d })))
.then(({ ok, text }) => {
Expand All @@ -73,6 +74,7 @@ const Dialog: React.FC<DialogProps> = ({ open, setOpen, selectedElement }) => {
selectedElement.setAttribute('type', 'button')
} else {
const source = `
const e = arguments[0]
const form = e.target.closest('form')
form.submit()
`
Expand Down

0 comments on commit 0dfc44f

Please sign in to comment.