Laravel-debugbar: Problems with Axios?

Created on 12 Jul 2017  路  9Comments  路  Source: barryvdh/laravel-debugbar

I have been using Axios in a few projects and it doesn't seem that Debugbar picks up any of these requests. Switching to using $.ajax and the Debugbar captures the request.

Has anyone had this issue before (I searched and couldn't find an issue but still..)?

stale

Most helpful comment

I'm facing this problem to, and I use this.

axios.interceptors.response.use( (response) => { phpdebugbar.ajaxHandler.handle(response.request); return response; });

All 9 comments

I don't think debugbar hooks into axios. I would also be interested in a solution for Axios+Debugbar though.
Probably one would have to call some function of the global JS object PhpDebugBar.AjaxHandler from an axios interceptor.

Hmm I see, I'll take a look later into it and get back to you if I get anywhere.

Yeah similar to how laravel echo does it.

Has anyone figured this out for axios? I remember playing with it a while back and not succeeding.

any update on this? I can confirm that the axios requests are captured and logged. It correctly shows up in the dataset switcher modal (the folder icon on the far right) but the select dropdown is not triggered/shown for the latest request.

Very quick implementation per @jbbr solution:
axios.interceptors.response.use(undefined, response => phpdebugbar.ajaxHandler.handle(response.request))
eventually adds the requests into the dropdown

I'm facing this problem to, and I use this.

axios.interceptors.response.use( (response) => { phpdebugbar.ajaxHandler.handle(response.request); return response; });

@frdteknikelektro I'm not familiar with axios interceptors - would you mind sharing where you use that code?

Update: nevermind, sorry @frdteknikelektro. I put it in my app.js and it's working 馃憣

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further.
Thank you for your contribution! Apologies for any delayed response on our side.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

knvpk picture knvpk  路  5Comments

hussein-elhussein picture hussein-elhussein  路  3Comments

ddmo picture ddmo  路  3Comments

linaspasv picture linaspasv  路  5Comments

alphametric picture alphametric  路  5Comments