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