From 787d96533156927711386d1c657b233ecb6c47cf Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Wed, 12 Jul 2023 17:32:27 -0700 Subject: [PATCH] web: disable signup button while submitting --- web/app/download/signup.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/app/download/signup.tsx b/web/app/download/signup.tsx index 1356185c..4cdecef9 100644 --- a/web/app/download/signup.tsx +++ b/web/app/download/signup.tsx @@ -4,6 +4,7 @@ import { useState } from 'react' export default function Signup() { const [email, setEmail] = useState('') + const [submitting, setSubmitting] = useState(false) const [success, setSuccess] = useState(false) return ( @@ -11,6 +12,8 @@ export default function Signup() { onSubmit={async e => { e.preventDefault() + setSubmitting(true) + await fetch('/api/signup', { method: 'POST', headers: { @@ -19,6 +22,7 @@ export default function Signup() { body: JSON.stringify({ email }), }) + setSubmitting(false) setSuccess(true) setEmail('') @@ -38,7 +42,8 @@ export default function Signup() { {success &&

You're signed up for updates

}