X-Git-Url: https://git.auder.net/js/img/rock_paper_scissors_lizard_spock.gif?a=blobdiff_plain;f=client%2Fsrc%2Fdata%2FchallengeCheck.js;h=626b7cf681c08e40da448b48951190b76e3312b2;hb=714680114508183fba2c07231dbe8f90b5631b81;hp=c2700008370f5fbb6014782acc09e8f6633f2962;hpb=bebcc8d45532e67902175f69084a08040f06855f;p=vchess.git diff --git a/client/src/data/challengeCheck.js b/client/src/data/challengeCheck.js index c2700008..626b7cf6 100644 --- a/client/src/data/challengeCheck.js +++ b/client/src/data/challengeCheck.js @@ -2,21 +2,21 @@ import { extractTime } from "@/utils/timeControl"; export function checkChallenge(c) { - const vid = parseInt(c.vid); - if (isNaN(vid) || vid <= 0) - return "Please select a variant"; + const vid = parseInt(c.vid); + if (isNaN(vid) || vid <= 0) + return "Please select a variant"; - const tc = extractTime(c.timeControl); + const tc = extractTime(c.cadence); if (!tc) return "Wrong time control"; - // Basic alphanumeric check for opponent name - if (!!c.to) - { - // TODO: slightly redundant (see data/userCheck.js) - if (!c.to.match(/^[\w]+$/)) - return "Wrong characters in opponent name"; - } + // Basic alphanumeric check for opponent name + if (!!c.to) + { + // NOTE: slightly redundant (see data/userCheck.js) + if (!c.to.match(/^[\w]+$/)) + return "Wrong characters in opponent name"; + } // Allow custom FEN (and check it) only for individual challenges if (c.fen.length > 0 && !!c.to)