
import axios from "axios";
axios.defaults.headers.get["Content-Type"] = "application/x-www-form-urlencoded";
axios.defaults.withCredentials = true;
const getHeader = () => {
    let header = {};
    // ...添加鉴权token信息
    // let authentica = localStorage.getExpire("Authentica_saas")
    return Object.assign(header, authentica);
}

axios.interceptors.request.use(
    config => {
        const { withToken } = config;
        if (withToken) {
            config.headers = Object.assign(config.headers, getHeader())
        }
        return config;
    },
    err => {
        return Promise.reject(err);
    }
);
axios.interceptors.response.use(function (response) { // 对响应数据
    const { data, config } = response;
    const { result, msg } = data;
    if (result == 13003 || result == 13001 || result == 13004 || result == 13005) {
        // 跳转到 登陆页面
        console.log('ckx debug token 失效', )
    }
    return response;
}, function (error) {// 对响应错误
  return Promise.reject(error);
});
export default axios;
