remember added
This commit is contained in:
@@ -29,12 +29,14 @@ const fields: AuthFormField[] = [{
|
|||||||
|
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
email: z.email('Invalid email'),
|
email: z.email('Invalid email'),
|
||||||
password: z.string('Password is required').min(8, 'Must be at least 8 characters')
|
password: z.string('Password is required').min(8, 'Must be at least 8 characters'),
|
||||||
|
remember: z.boolean().optional()
|
||||||
})
|
})
|
||||||
|
|
||||||
type Schema = z.output<typeof schema>
|
type Schema = z.output<typeof schema>
|
||||||
|
|
||||||
function onSubmit(payload: FormSubmitEvent<Schema>) {
|
function onSubmit(payload: FormSubmitEvent<Schema>) {
|
||||||
|
console.log(payload.data)
|
||||||
return fetch("/login", {
|
return fetch("/login", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@@ -42,7 +44,8 @@ function onSubmit(payload: FormSubmitEvent<Schema>) {
|
|||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
email: payload.data.email,
|
email: payload.data.email,
|
||||||
password: payload.data.password
|
password: payload.data.password,
|
||||||
|
remember: payload.data.remember || false
|
||||||
})
|
})
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
if (response.ok)
|
if (response.ok)
|
||||||
|
|||||||
Reference in New Issue
Block a user