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
|
||||
|
||||
@@ -6,7 +6,7 @@ import EmptyLayout from '~/pages/layout/emptyLayout.vue'
|
||||
defineOptions({ layout: EmptyLayout })
|
||||
|
||||
const form = useForm({
|
||||
fullName: '',
|
||||
name: '',
|
||||
email: '',
|
||||
password: '',
|
||||
passwordConfirmation: '',
|
||||
@@ -21,15 +21,15 @@ const form = useForm({
|
||||
<p class="text-sm text-gray-600 mt-2">Join PC Creator today</p>
|
||||
</div>
|
||||
|
||||
<Form route="account.signup" #default="{ processing, errors }">
|
||||
<Form route="new_account.store" #default="{ processing, errors }">
|
||||
<div class="space-y-4 sm:space-y-6">
|
||||
<div>
|
||||
<label class="block">
|
||||
<span class="text-sm font-medium text-gray-700 mb-2 block">Full Name</span>
|
||||
<input
|
||||
v-model="form.fullName"
|
||||
v-model="form.name"
|
||||
class="w-full px-3 sm:px-4 py-2 sm:py-3 border-2 border-gray-300 rounded-lg focus:border-indigo-600 focus:ring-2 focus:ring-indigo-500/40 transition text-base"
|
||||
name="fullName"
|
||||
name="name"
|
||||
type="text"
|
||||
placeholder="Enter your full name"
|
||||
/>
|
||||
@@ -86,7 +86,7 @@ const form = useForm({
|
||||
<div class="text-center mt-4">
|
||||
<p class="text-sm text-gray-600">
|
||||
Already have an account?
|
||||
<Link route="auth.show_login" class="text-indigo-600 hover:text-indigo-700 font-semibold">
|
||||
<Link route="session.create" class="text-indigo-600 hover:text-indigo-700 font-semibold">
|
||||
Login
|
||||
</Link>
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user