All Inertia requests must receive a valid Inertia response, however a plain JSON response was received

260 Views Asked by At

I have a problem using routes with inertia, I'm using AdonisJS + Inertia + Svelte

Everything running perfectly, but when clicking on links of routes it only returns me this problem

My Home.svelte:

enter image description here

My router:

Route.get('/second', 'SecondsController.index')

Controller:

import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'

export default class PostsController {
  public async index({ inertia }: HttpContextContract) {
    const mydata = {
        title: "Second Page",
        content: "Some content here.",
      };

    return inertia.render('Second', { mydata })
  }
}

Message I receive when clicking on the link: enter image description here

This message simply appears and does not go to the other page

0

There are 0 best solutions below