1👍
Try this.
Create a new file name interceptors.js
interceptors.js
import axios from 'axios';
import Vue from 'vue'
export default function setup() {
axios.interceptors.response.use(function (config) {
// Do something before the request is sent
return config;
}, function (error) {
// Do something with request error
return Promise.reject(error);
});
}
then in your app.js
import the interceptors.js
app.js
import interceptorsSetup from './interceptors';
interceptorsSetup()
- [Vuejs]-VUE on-changed checked and ajax request
- [Vuejs]-How to add custom properties to a page in VueJS / Gridsome
Source:stackexchange.com