shellphone.app/app/auth/validations.ts
2021-09-25 21:15:16 +08:00

30 lines
631 B
TypeScript

import { z } from "zod";
export const password = z.string().min(10).max(100);
export const Signup = z.object({
name: z.string(),
email: z.string().email(),
password,
});
export const Login = z.object({
email: z.string().email(),
password: z.string(),
});
export const ForgotPassword = z.object({
email: z.string().email(),
});
export const ResetPassword = z
.object({
password: password,
passwordConfirmation: password,
token: z.string(),
})
.refine((data) => data.password === data.passwordConfirmation, {
message: "Passwords don't match",
path: ["passwordConfirmation"], // set the path of the error
});