first fixes
This commit is contained in:
@@ -5,18 +5,18 @@ import EmptyLayout from '~/pages/layout/emptyLayout.vue'
|
||||
|
||||
defineOptions({ layout: EmptyLayout })
|
||||
|
||||
const props = defineProps<{ errors?: any[] | any }>()
|
||||
const props = defineProps<{ errors?: Record<string, string> }>()
|
||||
|
||||
const vineErrors = computed(() => {
|
||||
if (Array.isArray(props.errors)) {
|
||||
return props.errors as any[]
|
||||
if (props.errors && !Array.isArray(props.errors)) {
|
||||
return props.errors
|
||||
}
|
||||
return []
|
||||
return {}
|
||||
})
|
||||
|
||||
const authError = computed(() => {
|
||||
if (!Array.isArray(props.errors) && props.errors) {
|
||||
return props.errors as any
|
||||
if (props.errors && !Array.isArray(props.errors)) {
|
||||
return props.errors
|
||||
}
|
||||
return null
|
||||
})
|
||||
@@ -27,13 +27,8 @@ const form = useForm({
|
||||
})
|
||||
|
||||
function getErrorMessage(field: string): string | null {
|
||||
const error = vineErrors.value.find((error) => error.field === field)
|
||||
return error ? error.message : null
|
||||
return vineErrors.value[field] || null
|
||||
}
|
||||
|
||||
console.log(authError)
|
||||
console.log(vineErrors)
|
||||
console.log(props)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -109,7 +104,7 @@ console.log(props)
|
||||
<Link
|
||||
as="button"
|
||||
class="w-full px-3 sm:px-4 py-2 sm:py-3 mt-3 sm:mt-4 text-base font-semibold text-indigo-600 bg-gray-100 rounded-lg hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-indigo-500/40 transition"
|
||||
href="/account/signup"
|
||||
href="/auth/signup"
|
||||
type="button"
|
||||
>
|
||||
Create an account
|
||||
|
||||
Reference in New Issue
Block a user