add auth, logout
This commit is contained in:
+27
-15
@@ -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(),
|
||||
})
|
||||
Reference in New Issue
Block a user