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