add auth, logout

This commit is contained in:
smanylov
2025-11-28 15:28:15 +07:00
parent 5c1a60645f
commit c4ece25c61
6 changed files with 125 additions and 34 deletions
+27 -15
View File
@@ -1,5 +1,21 @@
import * as z from 'zod'
export type FormState =
| {
errors?: {
name?: string[]
email?: string[]
password?: string[]
}
message?: string
}
| undefined
export type FormAction = (
state: FormState,
formData: FormData
) => Promise<FormState>
export const SignupFormSchema = z
.object({
full_name: z
@@ -21,18 +37,14 @@ export const SignupFormSchema = z
path: ['confirm_password'],
});
export type FormState =
| {
errors?: {
name?: string[]
email?: string[]
password?: string[]
}
message?: string
}
| undefined
export type FormAction = (
state: FormState,
formData: FormData
) => Promise<FormState>
export const loginFormSchema = z
.object({
email: z
.string()
.min(1, { error: 'Email must be not empty' })
.trim(),
password: z
.string()
.min(1, { error: 'Password must be not empty' })
.trim(),
})