Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
787d9653
Commit
787d9653
authored
Jul 12, 2023
by
Jeffrey Morgan
Browse files
web: disable signup button while submitting
parent
e6eee073
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
web/app/download/signup.tsx
web/app/download/signup.tsx
+6
-1
No files found.
web/app/download/signup.tsx
View file @
787d9653
...
...
@@ -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() {
<
input
type
=
'submit'
value
=
'Get updates'
className
=
'bg-black text-white rounded-lg px-4 py-2 focus:outline-none cursor-pointer'
disabled
=
{
submitting
}
className
=
'bg-black text-white disabled:text-neutral-200 disabled:bg-neutral-700 rounded-lg px-4 py-2 focus:outline-none cursor-pointer'
/>
{
success
&&
<
p
className
=
'text-center text-sm'
>
You
'
re signed up for updates
</
p
>
}
</
form
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment