提交 58c76159 authored 作者: 王鹏飞's avatar 王鹏飞

修改axios请求拦截

上级 d8477f17
......@@ -14,6 +14,7 @@ const httpRequest = axios.create({
// 请求拦截
httpRequest.interceptors.request.use(
function(config) {
if (config.url.includes('/api/cms')) {
const defaultParams = {
timestamp: parseInt(Date.now() / 1000),
nonce: Math.random()
......@@ -38,9 +39,10 @@ httpRequest.interceptors.request.use(
} else {
config.params = params
}
// if (config.headers['Content-Type'] === 'application/x-www-form-urlencoded') {
// config.data = qs.stringify(config.data)
// }
}
if (config.headers['Content-Type'] === 'application/x-www-form-urlencoded') {
config.data = qs.stringify(config.data)
}
if (config.headers['Content-Type'] === 'multipart/form-data') {
const form = new window.FormData()
for (const key in config.data) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论