bug
jiangping
2023-12-06 1f4e7d0f73a73e7350cf5a1df279d5f30904c5d5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/**
 * 请求拦截
 * @param {Object} http
 */
module.exports = (vm) => {
    uni.$u.http.interceptors.request.use((config) => { // 可使用async await 做异步操作
        console.log(config);
        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 做异步操作
}