mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-05-13 13:17:45 +00:00
fix: youtubeId should be null not empty on submit form
This commit is contained in:
parent
903f36f1ee
commit
ed70596619
1 changed files with 3 additions and 2 deletions
|
|
@ -39,8 +39,9 @@ const submitSchema = z
|
||||||
miiFeaturesImage: z.union([z.instanceof(File), z.any()]).optional(),
|
miiFeaturesImage: z.union([z.instanceof(File), z.any()]).optional(),
|
||||||
youtubeId: z
|
youtubeId: z
|
||||||
.string()
|
.string()
|
||||||
.regex(/^[a-zA-Z0-9_-]{11}$/, "Invalid YouTube video ID")
|
.trim()
|
||||||
.or(z.literal(""))
|
.transform((val) => (val === "" ? null : val))
|
||||||
|
.refine((val) => val === null || /^[a-zA-Z0-9_-]{11}$/.test(val), "Invalid YouTube video ID")
|
||||||
.optional(),
|
.optional(),
|
||||||
instructions: switchMiiInstructionsSchema,
|
instructions: switchMiiInstructionsSchema,
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue