|
|
|
@ -17,6 +17,7 @@ import NProgress from 'nprogress'; // progress bar
|
|
|
|
|
import 'nprogress/nprogress.css'; // progress bar style
|
|
|
|
|
import { Base64 } from 'js-base64'; |
|
|
|
|
import { baseUrl } from '@/config/env'; |
|
|
|
|
import crypto from '@/utils/crypto'; |
|
|
|
|
|
|
|
|
|
axios.defaults.timeout = 10000; |
|
|
|
|
//返回其他状态吗
|
|
|
|
@ -45,11 +46,16 @@ axios.interceptors.request.use(
|
|
|
|
|
`${website.clientId}:${website.clientSecret}` |
|
|
|
|
)}`;
|
|
|
|
|
} |
|
|
|
|
//让每个请求携带token
|
|
|
|
|
//headers判断请求是否携带token
|
|
|
|
|
const meta = config.meta || {}; |
|
|
|
|
const isToken = meta.isToken === false; |
|
|
|
|
if (getToken() && !isToken) { |
|
|
|
|
config.headers[website.tokenHeader] = 'bearer ' + getToken(); |
|
|
|
|
//headers传递token是否加密
|
|
|
|
|
const cryptoToken = config.cryptoToken === true; |
|
|
|
|
const token = getToken(); |
|
|
|
|
if (token && !isToken) { |
|
|
|
|
config.headers[website.tokenHeader] = cryptoToken |
|
|
|
|
? 'crypto ' + crypto.encrypt(token) |
|
|
|
|
: 'bearer ' + token; |
|
|
|
|
} |
|
|
|
|
//headers中配置text请求
|
|
|
|
|
if (config.text === true) { |
|
|
|
|