add registration and session logic
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import * as z from 'zod'
|
||||
|
||||
export const SignupFormSchema = z.object({
|
||||
name: z
|
||||
.string()
|
||||
.min(2, { error: 'Name must be at least 2 characters long.' })
|
||||
.trim(),
|
||||
email: z.email({ error: 'Please enter a valid email.' }).trim(),
|
||||
password: z
|
||||
.string()
|
||||
.min(5, { error: 'Be at least 5 characters long' })
|
||||
.regex(/[a-zA-Z]/, { error: 'Contain at least one letter.' })
|
||||
.regex(/[0-9]/, { error: 'Contain at least one number.' })
|
||||
.trim(),
|
||||
})
|
||||
|
||||
export type FormState =
|
||||
| {
|
||||
errors?: {
|
||||
name?: string[]
|
||||
email?: string[]
|
||||
password?: string[]
|
||||
}
|
||||
message?: string
|
||||
}
|
||||
| undefined
|
||||
|
||||
export type FormAction = (
|
||||
state: FormState,
|
||||
formData: FormData
|
||||
) => Promise<FormState>
|
||||
Reference in New Issue
Block a user