[Vuejs]-About Framework7-vue-cli Ajax Interceptor

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()

Leave a comment