Skip to content

Commit

Permalink
clear form after submission
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanClementsHax committed May 13, 2024
1 parent cbaa548 commit b9bf12b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions components/pages/posts/[slug]/SubscribeForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export function SubscribeForm(): JSX.Element {
body: JSON.stringify({ email, referringUrl: window.location.href })
})
const { message } = await res.json()
if (res.ok) {
;(e.target as HTMLFormElement).reset()
}
setFormState({
ok: res.ok,
message
Expand Down

0 comments on commit b9bf12b

Please sign in to comment.