From 51dd55419352aa2f4f36286c20298f6fd263a048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E5=90=89=E6=AC=A2?= Date: Tue, 27 Mar 2018 14:56:53 +0800 Subject: [PATCH] add js --- fangija-zsyf/js/axiosPlugin.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 fangija-zsyf/js/axiosPlugin.js diff --git a/fangija-zsyf/js/axiosPlugin.js b/fangija-zsyf/js/axiosPlugin.js new file mode 100644 index 0000000..bfa7c47 --- /dev/null +++ b/fangija-zsyf/js/axiosPlugin.js @@ -0,0 +1,17 @@ +axios.defaults.baseURL = BASE_PATH; +axios.defaults.headers.post['Content-Type'] = 'application/json'; + +// 添加请求拦截器 +axios.interceptors.request.use(function (config) { + config.headers.Authorization = '111111111' + return config; + }, function (error) { + return Promise.reject(error); +}); + +// 添加响应拦截器 +axios.interceptors.response.use(function (response) { + return response; + }, function (error) { + return Promise.reject(error); +}); \ No newline at end of file