From 083a4ada9db5fc9de9988d1b1a959dc17dd8bcd8 Mon Sep 17 00:00:00 2001 From: Pan Date: Mon, 8 Apr 2019 11:08:06 +0800 Subject: [PATCH] perf[request.js]: optimize error message --- src/utils/request.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/request.js b/src/utils/request.js index b043c933..d2422c46 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -43,7 +43,7 @@ service.interceptors.response.use( const res = response.data if (res.code !== 20000) { Message({ - message: res.message, + message: res.message || 'error', type: 'error', duration: 5 * 1000 }) @@ -61,7 +61,7 @@ service.interceptors.response.use( }) }) } - return Promise.reject('error') + return Promise.reject(res.message || 'error') } else { return res }