added steam regex support
This commit is contained in:
@@ -18,6 +18,10 @@ import * as z from 'zod';
|
||||
import DateInput from '../form/DateInput.vue';
|
||||
import { ApplicationData } from '@/api/application';
|
||||
|
||||
const regexA = /^https?:\/\/steamcommunity\.com\/id\/[A-Za-z0-9_]+\/?$/;
|
||||
const regexB = /^https?:\/\/steamcommunity\.com\/profiles\/\d+\/?$/;
|
||||
|
||||
|
||||
const formSchema = toTypedSchema(z.object({
|
||||
dob: z.string().refine(v => v, { message: "A date of birth is required." }),
|
||||
name: z.string().nonempty(),
|
||||
@@ -28,7 +32,7 @@ const formSchema = toTypedSchema(z.object({
|
||||
joinReason: z.string().nonempty(),
|
||||
milsimAttraction: z.string().nonempty(),
|
||||
referral: z.string().nonempty(),
|
||||
steamProfile: z.string().nonempty(),
|
||||
steamProfile: z.string().nonempty().refine((val) => regexA.test(val) || regexB.test(val), { message: "Invalid Steam profile URL." }),
|
||||
timezone: z.string().nonempty(),
|
||||
canAttendSaturday: z.boolean(),
|
||||
interests: z.string().nonempty(),
|
||||
|
||||
Reference in New Issue
Block a user