feat axios config

This commit is contained in:
smallwei 2019-02-15 15:43:41 +08:00
parent e855fc1ef6
commit d8d3157e87
3 changed files with 10 additions and 3 deletions

7
build.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
echo "打包文件"
yarn build
echo "传输文件"
scp -r ./dist/** pig@139.224.200.249:/data/avue/sword
echo "部署成功"

View File

@ -9,7 +9,7 @@ export default {
lockPage: '/lock',
tokenTime: 6000,
//http的status默认放行不才用统一处理的,
statusWhiteList: [400],
statusWhiteList: [],
//配置首页不可关闭
isFirstPage: false,
fistPage: {

View File

@ -44,9 +44,9 @@ axios.interceptors.request.use(config => {
//HTTPresponse拦截
axios.interceptors.response.use(res => {
NProgress.done();
const status = Number(res.status) || 200;
const status = res.data.code || 200
const statusWhiteList = website.statusWhiteList || [];
const message = res.data.message || '未知错误';
const message = res.data.msg || '未知错误';
//如果在白名单里则自行catch逻辑处理
if (statusWhiteList.includes(status)) return Promise.reject(res);
//如果是401则跳转到登录页面