|
@@ -2,6 +2,7 @@ import ElementUI from 'element-ui'
|
|
|
import axios from 'axios'
|
|
|
import { Message } from 'element-ui'
|
|
|
import store from '@/store'
|
|
|
+import qs from 'querystring'
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
import cleanDeep from 'clean-deep'
|
|
|
// import { Loading } from 'element-ui'
|
|
@@ -96,12 +97,14 @@ service.interceptors.request.use(
|
|
|
// ['X-Token'] is a custom headers key
|
|
|
// please modify it according to the actual situation
|
|
|
config.headers['Authorization'] = getToken()
|
|
|
- if (config.requestType === 'form') {
|
|
|
- config.headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
|
|
- }
|
|
|
+ }
|
|
|
+ if (config.requestType === 'form') {
|
|
|
+ config.headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
|
|
+ config.data = qs.stringify(cleanDeep(config.data))
|
|
|
+ } else {
|
|
|
+ config.data = cleanDeep(config.data)
|
|
|
}
|
|
|
config.params = cleanDeep(config.params)
|
|
|
- config.data = cleanDeep(config.data)
|
|
|
return config
|
|
|
},
|
|
|
error => {
|