123456789101112131415161718192021 |
- const defaultSetting = require('@/setting')
- import store from '@/store'
- uni.$u.http.setConfig((config) => {
- config.baseURL = defaultSetting.BASE_URL
- config.header = {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'X-Requested-With': 'XMLHttpRequest',
- 'Accept': 'application/vnd.api.v1+json'
- }
- if (store.getters.token) {
- config.header['Authorization'] = store.getters.token
- }
- return config
- })
- module.exports = (vm) => {
- require('./requestInterceptors')(vm)
- require('./responseInterceptors')(vm)
- }
|