first fixes

This commit is contained in:
Kevin
2026-06-29 22:59:06 +02:00
parent c6d43040c5
commit 3721b98420
5 changed files with 89 additions and 24 deletions
+5 -4
View File
@@ -8,9 +8,7 @@ import ComponentType from '#models/component_type'
export default class ComponentsController {
async index({ inertia, auth }: HttpContext) {
const user = await auth.authenticate()
const components = await Component.query()
.preload('type')
.where('userId', user.id)
const components = await Component.query().preload('type').where('userId', user.id)
return inertia.render('components/index', { components: components.map((c) => c.serialize()) })
}
@@ -54,7 +52,10 @@ export default class ComponentsController {
.where('userId', user.id)
.andWhere('id', componentId)
.firstOrFail()
return inertia.render('components/edit', { component: component.serialize(), types: types.map((t) => t.serialize()) })
return inertia.render('components/edit', {
component: component.serialize(),
types: types.map((t) => t.serialize()),
})
}
async update({ params, auth, request, response }: HttpContext) {