| | |
| | | } |
| | | if (token) { |
| | | config.headers['token'] = "" + token |
| | | config.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' |
| | | // config.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' |
| | | // config.headers['Content-Type'] = 'application/json' |
| | | } |
| | | // console.log(config) |
| | | if (config.method === 'post' || config.method === 'put') { |
| | | |
| | | config.data = qs.stringify(config.data) |
| | | } |
| | | if(config.headers['Content-Type'] =='application/json'){ |
| | | config.data = qs.parse(config.data) |
| | | // console.log(config.data) |
| | | } |
| | | |
| | | return config |
| | | }, function(error) { |
| | | return Promise.reject(error) |