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, ref } from 'vue'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
import AuthLayout from '@/layouts/AuthLayout.vue'
|
||||
import { loginSchema } from '@/validation/auth'
|
||||
|
||||
const { config, flash } = useAuth()
|
||||
|
||||
@@ -41,11 +42,7 @@ const providers = computed(() =>
|
||||
})),
|
||||
)
|
||||
|
||||
const schema = v.object({
|
||||
login: v.pipe(v.string('Email or username is required'), v.nonEmpty('Email or username is required')),
|
||||
password: v.pipe(v.string('Password is required'), v.nonEmpty('Password is required')),
|
||||
remember: v.optional(v.boolean()),
|
||||
})
|
||||
const schema = loginSchema
|
||||
|
||||
type Schema = v.InferOutput<typeof schema>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user