From 171cf5b9966a600933ede0e96b6f961e2d4f4294 Mon Sep 17 00:00:00 2001 From: sin <2943460818@qq.com> Date: Mon, 4 Mar 2019 11:34:08 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BC=98=E5=8C=96=20undefined=20=E6=83=85?= =?UTF-8?q?=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin-web/src/utils/request.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/admin-web/src/utils/request.js b/admin-web/src/utils/request.js index 9401d1ec3..fdeb460e8 100644 --- a/admin-web/src/utils/request.js +++ b/admin-web/src/utils/request.js @@ -108,7 +108,9 @@ export default function request(url, option) { // 将登陆的 accessToken 放到 header const loginToken = getLoginToken(); - newOptions.headers.Authorization = loginToken.accessToken; + if (loginToken && loginToken.accessToken) { + newOptions.headers.Authorization = loginToken.accessToken; + } const expirys = options.expirys && 60; // options.expirys !== false, return the cache,