fix(import): refine MangaDex ID validation logic in import dialog
This commit is contained in:
parent
c48b88ff61
commit
2d39ba25e9
@ -35,18 +35,7 @@ export const MangaDexImportDialog = ({
|
|||||||
const formSchema = z
|
const formSchema = z
|
||||||
.object({
|
.object({
|
||||||
value: z.string().min(1, "Please enter a MangaDex ID or URL."),
|
value: z.string().min(1, "Please enter a MangaDex ID or URL."),
|
||||||
})
|
});
|
||||||
.refine(
|
|
||||||
(data: { value: string }) =>
|
|
||||||
data.value.length > 36 &&
|
|
||||||
!data.value.match(/title\/([0-9a-fA-F-]{36})/) &&
|
|
||||||
data.value.length !== 36,
|
|
||||||
{
|
|
||||||
message: "Invalid MangaDex ID or URL",
|
|
||||||
path: ["value"],
|
|
||||||
abort: true,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user