From 3e4b4e749cce446f3d122ab62012d1c659e1788a Mon Sep 17 00:00:00 2001 From: chenzeping <ChenZeping02609@163.com> Date: 星期二, 16 三月 2021 18:07:35 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' into master --- src/utils/axios.js | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/utils/axios.js b/src/utils/axios.js index e759790..a5bb1ab 100644 --- a/src/utils/axios.js +++ b/src/utils/axios.js @@ -2,7 +2,7 @@ import axios from 'axios' import * as $CONST from '@/utils/constant' import * as $T from '@/utils/tools' -import $store from '@/store' +// import $store from '@/store' /** * 瀹氫箟浼犲叆鍙傛暟鏁版嵁鏍煎紡 @@ -112,16 +112,16 @@ } } return config - }*/ + } */ // request鎷︽埅鍣� Service.interceptors.request.use( config => { - // 涓存椂杩藉姞 - if ($store.state.user.account) { - config.headers.account = $store.state.user.account - } - let copyConfig = Object.assign({}, config) + // 涓存椂杩藉姞 + // if ($store.state.user.account) { + // config.headers.account = $store.state.user.account + // } + const copyConfig = Object.assign({}, config) // copyConfig = filterOauthData(copyConfig) // showDebugInfo(copyConfig) copyConfig.cancelToken = new CancelToken((c) => { @@ -142,7 +142,7 @@ const res = response.data if (Number(res.code) !== 200 && Number(res.code) !== 0) { $T.warning(res.message) - return res + return Promise.reject(res.message) } else { return res } @@ -178,7 +178,7 @@ const $http = {} $http.$service = Service $http.$axios = axios -$http.get = function(url, params = {}) { +$http.get = function (url, params = {}) { if ($T.isInlineParams(url)) { // 涓ユ牸閬靛惊restful鏍囧噯鐨剈rl鐨勫満鏅� url = $T.replaceUrlParams(url, params) @@ -190,21 +190,21 @@ params: $T.filterParams(params) }) } -$http.post = function(url, data = {}) { +$http.post = function (url, data = {}) { return Service({ url: url, method: 'post', data: data }) } -$http.put = function(url, data = {}) { +$http.put = function (url, data = {}) { return Service({ url: url, method: 'put', data: data }) } -$http.delete = function(url, data = {}) { +$http.delete = function (url, data = {}) { return Service({ url: url, method: 'delete', -- Gitblit v1.8.0