Closed friendlyhomosapien closed 10 months ago
Hey! So this happens when you redirect to a page that isn't an Inertia response. All responses to an Inertia request must be a valid Inertia response — JSON responses are not supported. If you want to return JSON from a response then I'd recommend just using XHR/fetch instead. However generally you can find ways to make this work but just returning a valid Inertia response and providing some updated data as props.
Hope that helps!
I'm building a Vue app in my Laravel project using Inertiajs. When using the form helper and/or the router function I try to do a request to an endpoint that returns a redirect. Inertia responds to this with "All Inertia requests must receive a valid Inertia response, however a plain JSON response was received."
In my Vue page:
in my endpoint controller method:
return redirect()->route('scanV2.index');