first fixes

This commit is contained in:
Kevin
2026-06-29 22:54:53 +02:00
parent 66a97be5c6
commit c6d43040c5
3 changed files with 39 additions and 37 deletions
+4 -4
View File
@@ -11,12 +11,12 @@ export default class ComponentsController {
const components = await Component.query()
.preload('type')
.where('userId', user.id)
return inertia.render('components/index', { components })
return inertia.render('components/index', { components: components.map((c) => c.serialize()) })
}
async create({ inertia }: HttpContext) {
const types = await ComponentType.all()
return inertia.render('components/create', { types })
return inertia.render('components/create', { types: types.map((t) => t.serialize()) })
}
async store({ request, response, auth }: HttpContext) {
@@ -42,7 +42,7 @@ export default class ComponentsController {
.where('userId', user.id)
.andWhere('id', componentId)
.firstOrFail()
return inertia.render('components/show', { component })
return inertia.render('components/show', { component: component.serialize() })
}
async edit({ params, auth, inertia }: HttpContext) {
@@ -54,7 +54,7 @@ export default class ComponentsController {
.where('userId', user.id)
.andWhere('id', componentId)
.firstOrFail()
return inertia.render('components/edit', { component, types })
return inertia.render('components/edit', { component: component.serialize(), types: types.map((t) => t.serialize()) })
}
async update({ params, auth, request, response }: HttpContext) {