| import { z } from 'zod'
|
|
|
| export const loginSchema = z.object({
|
| email: z.string().email('Neplatný email formát'),
|
| password: z.string().min(6, 'Heslo musí mít alespoň 6 znaků')
|
| })
|
|
|
| export const registerSchema = z.object({ |
| email: z.string().email('Neplatný email formát'), |
| password: z.string().min(6, 'Heslo musí mít alespoň 6 znaků'), |
| confirmPassword: z.string(), |
| fname: z.string().min(2, 'Jméno musí mít alespoň 2 znaky'), |
| sname: z.string().min(2, 'Příjmení musí mít alespoň 2 znaky'), |
| sex: z.enum(['female', 'male']).optional() |
| }).refine((data) => data.password === data.confirmPassword, { |
| message: 'Hesla se neshodují', |
| path: ['confirmPassword'], |
| }) |
|
|
| export const codeSchema = z.object({
|
| code: z.string().length(5, 'Kód musí mít přesně 5 znaků').regex(/^[A-Z0-9]{5}$/, 'Kód může obsahovat pouze písmena A-Z a číslice 0-9')
|
| })
|
|
|
| export type LoginForm = z.infer<typeof loginSchema>
|
| export type RegisterForm = z.infer<typeof registerSchema>
|
| export type CodeForm = z.infer<typeof codeSchema> |
|
|