File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import * as Skeleton from "../utils/skeleton";
77import * as Misc from "../utils/misc" ;
88import TypoList from "../utils/typo-list" ;
99import { z } from "zod" ;
10+ import { UserNameSchema } from "@monkeytype/contracts/users" ;
1011
1112export function enableSignUpButton ( ) : void {
1213 $ ( ".page.pageLogin .register.side button" ) . prop ( "disabled" , false ) ;
@@ -59,6 +60,14 @@ const checkNameDebounced = debounce(1000, async () => {
5960 updateSignupButton ( ) ;
6061 return ;
6162 }
63+
64+ const parsed = UserNameSchema . safeParse ( val ) ;
65+ if ( ! parsed . success ) {
66+ nameIndicator . show ( "unavailable" , parsed . error . errors [ 0 ] ?. message ) ;
67+ updateSignupButton ( ) ;
68+ return ;
69+ }
70+
6271 const response = await Ape . users . getNameAvailability ( {
6372 params : { name : val } ,
6473 } ) ;
You can’t perform that action at this time.
0 commit comments