Skip to content

Instantly share code, notes, and snippets.

@EverettBerry
Created July 31, 2022 00:39
Show Gist options
  • Save EverettBerry/254dcf3178055fb248901be22bb51724 to your computer and use it in GitHub Desktop.
Save EverettBerry/254dcf3178055fb248901be22bb51724 to your computer and use it in GitHub Desktop.
<button
css={buttonStyle(downloading, true)}
disabled={downloading}
onClick={async () => {
trackDownloadAppClick('mobile')
setDownloading(true)
setMessage('')
const response = await fetch(`${url}/api/download/mobile?email=${emailValue}`)
if (!response.ok) {
const body = await response.json()
setMessage(`Error sending email: ${body.error}`)
} else {
setMessage(`Email sent to ${emailValue}`)
}
setDownloading(false)
}}
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment