赞
踩
import axios from 'axios'
import { Notification } from 'element-ui'
// 创建axios实例
const service = axios.create({
// baseURL: 'http://192.168.1.69:5000',
baseURL: process.env.API_ROOT,
timeout: 80000, // 请求超时时间
withCredentials: true,
// crossDomain: true
})
// request拦截器
service.interceptors.request.use(
config => {
if (getToken()) {
config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
}
var lang = localStorage.getItem('lang')//因为项目中使用到了i18n国际化语言配置,请根据实际情况自行修改
if (!lang) {
lang = 'zh_CN'
}
config.headers['Accept-Language'] = lang.replace(/_/g, '-')
config.headers['Content-Type'] = 'applic
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。