fix(stats): stabilize newsletter form reset

This commit is contained in:
Adam 2026-05-29 09:03:16 -05:00
parent bccebb8a36
commit 0a60dbdcee
No known key found for this signature in database
GPG key ID: 9CB48779AF150E75

View file

@ -1648,15 +1648,16 @@ function SubscribeModal(props: { onClose: () => void }) {
method="post"
onSubmit={(event) => {
event.preventDefault()
const form = event.currentTarget
setStatus("pending")
setMessage("")
fetch(`${import.meta.env.BASE_URL}api/newsletter`, {
method: "POST",
body: new FormData(event.currentTarget),
body: new FormData(form),
}).then(
async (response) => {
if (response.ok) {
event.currentTarget.reset()
form.reset()
setStatus("success")
return
}