22 lines
768 B
TypeScript
22 lines
768 B
TypeScript
import { z } from "zod";
|
|
|
|
export const registerFormSchema = z
|
|
.object({
|
|
fullname: z.string().min(4, "Full name must be at least 4 characters long"),
|
|
email: z.email("Invalid email address"),
|
|
password: z
|
|
.string()
|
|
.min(8, "Password must be at least 8 characters long")
|
|
.max(25, "Password must be at most 25 characters long"),
|
|
confirmPassword: z
|
|
.string()
|
|
.min(8, "Password must be at least 8 characters long")
|
|
.max(25, "Password must be at most 25 characters long"),
|
|
})
|
|
.refine((data) => data.password === data.confirmPassword, {
|
|
message: "Passwords confirmation does not match",
|
|
path: ["confirmPassword"],
|
|
});
|
|
|
|
export type RegisterFormSchema = z.infer<typeof registerFormSchema>;
|