From c06d16a1b3b1210c2ffa79c62fa78cc4d3d22849 Mon Sep 17 00:00:00 2001 From: LiuTongTong Date: Thu, 18 Jan 2018 01:05:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=8F=E5=B0=91=E5=B1=9E=E6=80=A7=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=20(#731)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 减少属性访问 * Update request.js --- src/utils/request.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/utils/request.js b/src/utils/request.js index 291d7cea..ccabf192 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -66,21 +66,22 @@ export default function request(url, options) { }) .catch((e) => { const { dispatch } = store; - if (e.name === 401) { + const status = e.name; + if (status === 401) { dispatch({ type: 'login/logout', }); return; } - if (e.name === 403) { + if (status === 403) { dispatch(routerRedux.push('/exception/403')); return; } - if (e.name <= 504 && e.name >= 500) { + if (status <= 504 && status >= 500) { dispatch(routerRedux.push('/exception/500')); return; } - if (e.name >= 404 && e.name < 422) { + if (status >= 404 && status < 422) { dispatch(routerRedux.push('/exception/404')); } }); -- GitLab