refactor: extract validation schemas to shared module
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { AuthFormField, FormSubmitEvent } from '@nuxt/ui'
|
||||
import type * as v from 'valibot'
|
||||
import { useForm } from '@inertiajs/vue3'
|
||||
import * as v from 'valibot'
|
||||
import { computed } from 'vue'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
import AuthLayout from '@/layouts/AuthLayout.vue'
|
||||
import { forgotPasswordSchema } from '@/validation/auth'
|
||||
|
||||
const { config, flash } = useAuth()
|
||||
|
||||
@@ -22,9 +23,7 @@ const fields: AuthFormField[] = [
|
||||
},
|
||||
]
|
||||
|
||||
const schema = v.object({
|
||||
email: v.pipe(v.string('Email is required'), v.nonEmpty('Email is required'), v.email('Please enter a valid email')),
|
||||
})
|
||||
const schema = forgotPasswordSchema
|
||||
|
||||
type Schema = v.InferOutput<typeof schema>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user