fix(stats): stabilize newsletter form reset

This commit is contained in:
Adam
2026-05-29 09:03:16 -05:00
parent bccebb8a36
commit 0a60dbdcee
+3 -2
View File
@@ -1648,15 +1648,16 @@ function SubscribeModal(props: { onClose: () => void }) {
method="post" method="post"
onSubmit={(event) => { onSubmit={(event) => {
event.preventDefault() event.preventDefault()
const form = event.currentTarget
setStatus("pending") setStatus("pending")
setMessage("") setMessage("")
fetch(`${import.meta.env.BASE_URL}api/newsletter`, { fetch(`${import.meta.env.BASE_URL}api/newsletter`, {
method: "POST", method: "POST",
body: new FormData(event.currentTarget), body: new FormData(form),
}).then( }).then(
async (response) => { async (response) => {
if (response.ok) { if (response.ok) {
event.currentTarget.reset() form.reset()
setStatus("success") setStatus("success")
return return
} }