12345678910111213141516171819202122232425 |
- import {
- getToken
- } from '../auth'
- /**
- * 请求拦截
- * @param {Object} http
- */
- // import store from '@/store'
- module.exports = vm => {
- uni.$u.http.interceptors.request.use(
- config => { // 可使用async await 做异步操作
- config.data = config.data || {}
- if (uni.getStorageSync('token')) {
- // config.header['Authorization'] = getToken()
- // config.header['Authorization'] = uni.getStorageSync('token')
- config.header['Authorization'] = uni.getStorageSync('token')
- }
- return config
- }, (config) => { // 可使用async await 做异步操作
- console.log(config);
- return Promise.reject(config)
- })
- }
|