| | |
| | | import pkg from '../../package' |
| | | import { trim } from './util' |
| | | import cache from '../plugins/cache' |
| | | import { Message } from 'element-ui' |
| | | import { Message, Loading } from 'element-ui' |
| | | |
| | | axios.defaults.headers.common['Content-Type'] = 'application/json;charset=UTF-8' |
| | | const axiosInstance = axios.create({ |
| | |
| | | // 设置操作平台 |
| | | config.headers['eva-platform'] = `pc-${pkg.version}` |
| | | // 设置认证头 |
| | | const authToken = Cookies.get('eva-auth-token') |
| | | const cookieName = process.env.VUE_APP_COOKIE_NAME || 'eva-auth-token' |
| | | const authToken = Cookies.get(cookieName) |
| | | if (authToken != null) { |
| | | config.headers['eva-auth-token'] = authToken |
| | | config.headers[cookieName] = authToken |
| | | } |
| | | return config |
| | | }, function (error) { |
| | |
| | | |
| | | // 新建响应拦截器 |
| | | axiosInstance.interceptors.response.use((response) => { |
| | | |
| | | // console.log(response.status) |
| | | // debugger |
| | | // 请求失败 |