Cleanup socketio stuff for typescript
This commit is contained in:
parent
3ad4422a94
commit
5e4ca8ef83
22 changed files with 246 additions and 210 deletions
22
resources/assets/scripts/helpers/axios.ts
Normal file
22
resources/assets/scripts/helpers/axios.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
import axios, {AxiosResponse} from 'axios';
|
||||
|
||||
/**
|
||||
* We'll load the axios HTTP library which allows us to easily issue requests
|
||||
* to our Laravel back-end. This library automatically handles sending the
|
||||
* CSRF token as a header based on the value of the "XSRF" token cookie.
|
||||
*/
|
||||
axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||
axios.defaults.headers.common['Accept'] = 'application/json';
|
||||
|
||||
// Attach the response data to phpdebugbar so that we can see everything happening.
|
||||
// @ts-ignore
|
||||
if (typeof phpdebugbar !== 'undefined') {
|
||||
axios.interceptors.response.use(function (response: AxiosResponse) {
|
||||
// @ts-ignore
|
||||
phpdebugbar.ajaxHandler.handle(response.request);
|
||||
|
||||
return response;
|
||||
});
|
||||
}
|
||||
|
||||
export default axios;
|
Loading…
Add table
Add a link
Reference in a new issue