mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-02-19 08:45:02 +08:00
impr(friends): validate username on add friend (@fehmer) (#7059)
fixes #7058
This commit is contained in:
parent
caae0d404e
commit
1cf316a772
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