mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-31 05:15:32 +00:00
fix(stats): stabilize newsletter form reset
This commit is contained in:
parent
bccebb8a36
commit
0a60dbdcee
1 changed files with 3 additions and 2 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue