mirror of
				https://github.com/monkeytypegame/monkeytype.git
				synced 2025-11-04 09:06:17 +08:00 
			
		
		
		
	impr(friends): validate username on add friend (@fehmer)
This commit is contained in:
		
							parent
							
								
									b9c4e4616e
								
							
						
					
					
						commit
						846f1c39ec
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -26,7 +26,7 @@ import { getAuthenticatedUser } from "../firebase";
 | 
			
		|||
import * as ServerConfiguration from "../ape/server-configuration";
 | 
			
		||||
import * as AuthEvent from "../observables/auth-event";
 | 
			
		||||
import { Connection } from "@monkeytype/schemas/connections";
 | 
			
		||||
import { Friend } from "@monkeytype/schemas/users";
 | 
			
		||||
import { Friend, UserNameSchema } from "@monkeytype/schemas/users";
 | 
			
		||||
import * as Loader from "../elements/loader";
 | 
			
		||||
 | 
			
		||||
const pageElement = $(".page.pageFriends");
 | 
			
		||||
| 
						 | 
				
			
			@ -73,6 +73,7 @@ const addFriendModal = new SimpleModal({
 | 
			
		|||
      type: "text",
 | 
			
		||||
      initVal: "",
 | 
			
		||||
      validation: {
 | 
			
		||||
        schema: UserNameSchema,
 | 
			
		||||
        isValid: async (name: string) => {
 | 
			
		||||
          const checkNameResponse = await Ape.users.getNameAvailability({
 | 
			
		||||
            params: { name: name },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue