1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| const FormSchema = z.object({ circleName: z.string().min(2, { message: "circleName must be at least 2 characters.", }), category: z.string().nonempty({ message: "not null" }), intro: z.string().optional(), imageUrl: z.string().url({ message: "Please upload a valid image" }) })
const form = useForm<z.infer<typeof FormSchema>>({ resolver: zodResolver(FormSchema), defaultValues: { circleName: "", category: "" }, })
function onSubmit(data: z.infer<typeof FormSchema>) {
showGlobalLoader() setTimeout(() => { hideGlobalLoader(); }, 5000); toast({ title: "You submitted the following values:", description: ( <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4"> <code className="text-white">{JSON.stringify(data, null, 2)}</code> </pre> ), }) }
|