fix: youtubeId should be null not empty on submit form

This commit is contained in:
trafficlunar 2026-04-09 12:51:33 +01:00
parent 903f36f1ee
commit ed70596619

View file

@ -39,8 +39,9 @@ const submitSchema = z
miiFeaturesImage: z.union([z.instanceof(File), z.any()]).optional(),
youtubeId: z
.string()
.regex(/^[a-zA-Z0-9_-]{11}$/, "Invalid YouTube video ID")
.or(z.literal(""))
.trim()
.transform((val) => (val === "" ? null : val))
.refine((val) => val === null || /^[a-zA-Z0-9_-]{11}$/.test(val), "Invalid YouTube video ID")
.optional(),
instructions: switchMiiInstructionsSchema,