first fixes
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user