forked from NotNet/gluestick
babyproofing
This commit is contained in:
parent
e01278e050
commit
9c65c76026
1 changed files with 4 additions and 1 deletions
|
@ -54,6 +54,7 @@ export default function RegisterForm({ ticket }: { ticket: string }) {
|
|||
const passwordRef = React.useRef<HTMLInputElement>(null);
|
||||
const confirmPasswordRef = React.useRef<HTMLInputElement>(null);
|
||||
const avatarRef = React.useRef<HTMLInputElement>(null);
|
||||
const submitRef = React.useRef<HTMLInputElement>(null);
|
||||
|
||||
const [usernameTaken, setUsernameTaken] = React.useState(false);
|
||||
const [passwordMismatch, setPasswordMismatch] = React.useState(false);
|
||||
|
@ -64,6 +65,7 @@ export default function RegisterForm({ ticket }: { ticket: string }) {
|
|||
<form
|
||||
onSubmit={async (e) => {
|
||||
e.preventDefault();
|
||||
submitRef.current!.disabled = true;
|
||||
|
||||
const [username, displayName, email, password, confirmPassword] = [
|
||||
usernameRef,
|
||||
|
@ -101,6 +103,7 @@ export default function RegisterForm({ ticket }: { ticket: string }) {
|
|||
avatarBase64
|
||||
})
|
||||
});
|
||||
submitRef.current!.disabled = false;
|
||||
|
||||
if (req.status === 500) {
|
||||
// something real bad fucked up
|
||||
|
@ -191,7 +194,7 @@ export default function RegisterForm({ ticket }: { ticket: string }) {
|
|||
/>
|
||||
|
||||
<div className={styles.buttonContainer}>
|
||||
<input type="submit" value="Join NotNet!" />
|
||||
<input type="submit" value="Join NotNet!" ref={submitRef} />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue