/**
|
* 请求拦截
|
* @param {Object} http
|
*/
|
module.exports = (vm) => {
|
uni.$u.http.interceptors.request.use((config) => { // 可使用async await 做异步操作
|
if (vm.$store.state.session) {
|
config.header['Cookie'] = 'eva-auth-token=' + vm.$store.state.session
|
}
|
uni.showLoading({ title: '请求中' });
|
config.data = config.data || {}
|
return config
|
}, (config) => Promise.reject(config)) // 可使用async await 做异步操作
|
}
|