first fixes

This commit is contained in:
Kevin
2026-06-29 22:48:59 +02:00
parent 184de52ad2
commit 66a97be5c6
25 changed files with 646 additions and 471 deletions
+3 -4
View File
@@ -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>
+3 -4
View File
@@ -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>
+1 -1
View File
@@ -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>