first fixes
This commit is contained in:
@@ -5,10 +5,10 @@ import { Link, usePage } from '@inertiajs/vue3'
|
||||
const { props } = usePage<{
|
||||
components: any[]
|
||||
states: any[]
|
||||
errors: any[]
|
||||
errors: Record<string, string>
|
||||
}>()
|
||||
const { components, states } = props
|
||||
const errors = computed(() => props.errors || [])
|
||||
const errors = computed(() => props.errors || {})
|
||||
|
||||
const componentTypeOrder = [
|
||||
'Processor',
|
||||
@@ -49,8 +49,7 @@ const form = reactive({
|
||||
})
|
||||
|
||||
function getErrorMessage(field: string): string | null {
|
||||
const error = errors.value.find((error) => error.field === field)
|
||||
return error ? error.message : null
|
||||
return errors.value[field] || null
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ const { props } = usePage<{
|
||||
computer: any
|
||||
availableComponents: any[]
|
||||
states: any[]
|
||||
errors?: any[]
|
||||
errors?: Record<string, string>
|
||||
}>()
|
||||
const { computer, availableComponents, states } = props
|
||||
const errors = computed(() => props.errors || [])
|
||||
const errors = computed(() => props.errors || {})
|
||||
|
||||
const form = reactive({
|
||||
id: computer.id,
|
||||
@@ -31,8 +31,7 @@ function deleteComputer(id: number) {
|
||||
}
|
||||
|
||||
function getErrorMessage(field: string): string | null {
|
||||
const error = errors.value.find((error) => error.field === field)
|
||||
return error ? error.message : null
|
||||
return errors.value[field] || null
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ defineProps<{ computers: any[] }>()
|
||||
href="/computers/create"
|
||||
type="button"
|
||||
as="button"
|
||||
class="px-4 py-2 bg-indigo-600 text-white rounded hover:bg-blue-700 transition"
|
||||
class="inline-flex shrink-0 px-4 py-2 bg-indigo-600 text-white rounded hover:bg-blue-700 transition"
|
||||
>
|
||||
Add
|
||||
</Link>
|
||||
|
||||
Reference in New Issue
Block a user