mirror of
https://github.com/chillzhuang/Saber.git
synced 2024-11-21 18:09:30 +08:00
feat axios config
This commit is contained in:
parent
e855fc1ef6
commit
d8d3157e87
7
build.sh
Executable file
7
build.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "打包文件"
|
||||||
|
yarn build
|
||||||
|
echo "传输文件"
|
||||||
|
scp -r ./dist/** pig@139.224.200.249:/data/avue/sword
|
||||||
|
echo "部署成功"
|
@ -9,7 +9,7 @@ export default {
|
|||||||
lockPage: '/lock',
|
lockPage: '/lock',
|
||||||
tokenTime: 6000,
|
tokenTime: 6000,
|
||||||
//http的status默认放行不才用统一处理的,
|
//http的status默认放行不才用统一处理的,
|
||||||
statusWhiteList: [400],
|
statusWhiteList: [],
|
||||||
//配置首页不可关闭
|
//配置首页不可关闭
|
||||||
isFirstPage: false,
|
isFirstPage: false,
|
||||||
fistPage: {
|
fistPage: {
|
||||||
|
@ -44,9 +44,9 @@ axios.interceptors.request.use(config => {
|
|||||||
//HTTPresponse拦截
|
//HTTPresponse拦截
|
||||||
axios.interceptors.response.use(res => {
|
axios.interceptors.response.use(res => {
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
const status = Number(res.status) || 200;
|
const status = res.data.code || 200
|
||||||
const statusWhiteList = website.statusWhiteList || [];
|
const statusWhiteList = website.statusWhiteList || [];
|
||||||
const message = res.data.message || '未知错误';
|
const message = res.data.msg || '未知错误';
|
||||||
//如果在白名单里则自行catch逻辑处理
|
//如果在白名单里则自行catch逻辑处理
|
||||||
if (statusWhiteList.includes(status)) return Promise.reject(res);
|
if (statusWhiteList.includes(status)) return Promise.reject(res);
|
||||||
//如果是401则跳转到登录页面
|
//如果是401则跳转到登录页面
|
||||||
|
Loading…
Reference in New Issue
Block a user