You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our Adonis Inertia SPA also has some api endpoints. When an api client request has an Accept: application/json header we would like to return a json response. Currently the default exception handler from the official starter kit returns an html response for any 404 route.
We had to modify the exception handler to the following:
Is it the 404 error page displayed by the router or some custom exception? Because, if it is the E_ROUTE_NOT_FOUND error, then we can have an handle method in there to perform the content negotiation like rest of the errors
@thetutlage it is not the 404 vue page that is returned, but as you expected the E_ROUTE_NOT_FOUND error is referenced in the data-page attribute of the first div in the body
Package version
3.1.1
Describe the bug
Our Adonis Inertia SPA also has some api endpoints. When an api client request has an
Accept: application/json
header we would like to return a json response. Currently the default exception handler from the official starter kit returns an html response for any 404 route.We had to modify the exception handler to the following:
Would this be a better out of the box default for the starter kit?
Happy to put in a pull request if this is the best way to handle both SPA and api requests in the same app.
Reproduction repo
No response
The text was updated successfully, but these errors were encountered: