From 1509bd26c799b223809ac0d05d005adb349680f5 Mon Sep 17 00:00:00 2001 From: sin <2943460818@qq.com> Date: Thu, 11 Apr 2019 21:28:32 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E6=B7=BB=E5=8A=A0=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E6=8F=90=E7=A4=BA=EF=BC=8C=E5=92=8C=E6=8B=A6?= =?UTF-8?q?=E6=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile-web/src/config/request.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/mobile-web/src/config/request.js b/mobile-web/src/config/request.js index becd9ca02..ff39806fc 100644 --- a/mobile-web/src/config/request.js +++ b/mobile-web/src/config/request.js @@ -114,7 +114,7 @@ const servicef = function (parameter) { data = JSON.parse(data); } resolve(data); - }) + }); return promist; } // 设置 access token @@ -128,7 +128,7 @@ const servicef = function (parameter) { // debugger; return service(parameter); -} +}; service.interceptors.request.use( @@ -160,7 +160,7 @@ service.interceptors.request.use( console.log(error) // for debug Promise.reject(error) } -) +); // response interceptor service.interceptors.response.use( @@ -192,8 +192,6 @@ service.interceptors.response.use( // }) // } - - // TODO token 过期 // TODO 需要拿 refresh token 置换 if (code === 1001001012) { @@ -218,7 +216,6 @@ service.interceptors.response.use( message: res.message, }); } - console.log(1); return Promise.reject('error') } else { // if (typeof response.data.Tag == 'string') { @@ -231,10 +228,15 @@ service.interceptors.response.use( } }, error => { - - return Promise.reject(error) + Dialog.alert({ + title: '系统提示', + message: error, + }); + console.error(`请求失败`, error); + throw new Error(error); + // return Promise.reject(error) } -) +); export default servicef