/**
|
|
* 请求拦截
|
|
* @param {Object} http
|
|
*/
|
|
module.exports = (vm) => {
|
|
uni.$u.http.interceptors.request.use((config) => {
|
|
config.data = config.data || {}
|
|
config.header['X-Access-Token'] = uni.getStorageSync('token');
|
|
config.header['Content-Type'] = 'application/x-www-form-urlencoded'
|
|
return config
|
|
}, config => {
|
|
return Promise.reject(config)
|
|
})
|
|
}
|
|
|
|
|