@@ -4,7 +4,8 @@ import { getToken } from '@/utils/auth'
44// create an axios instance
55const request = axios . create ( {
66 // baseURL: process.env.VUE_APP_URL,
7- baseURL : 'https://easy-mock.bookset.io/mock/5e90379d00bfc566e5bb1acb/example' ,
7+ // baseURL: 'https://easy-mock.bookset.io/mock/5e90379d00bfc566e5bb1acb/example', // 测试用地址
8+ baseURL : process . env . NODE_ENV === "development" ? '' : process . env . VUE_APP_URL , // 使用代理时,baseURL 在本地服务器设置为空
89 // withCredentials: true, // 跨域请求时发送cookie
910 timeout : 60000
1011} )
@@ -15,27 +16,24 @@ const TOKEN = getToken() // 获取token
1516request . interceptors . request . use (
1617 config => {
1718 if ( TOKEN ) {
18- // let each request carry token
19- // ['X-Token'] is a custom headers key
20- // please modify it according to the actual situation
2119 config . headers [ 'Authorization' ] = TOKEN
2220 }
2321
2422 // 扩展管理--expands:[]
25- if ( config . params && config . params . expandList ) {
26- const expandList = config . params . expandList
27- const expands = { }
28- if ( expandList && expandList . length ) {
29- expandList . map ( ( item , index ) => {
30- expands [ `expands[${ index } ]` ] = item
31- } )
32- config . params = {
33- ...config . params ,
34- ...expands
35- }
36- }
37- delete config . params . expandList
38- }
23+ // if (config.params && config.params.expandList) {
24+ // const expandList = config.params.expandList
25+ // const expands = {}
26+ // if (expandList && expandList.length) {
27+ // expandList.map((item, index) => {
28+ // expands[`expands[${index}]`] = item
29+ // })
30+ // config.params = {
31+ // ...config.params,
32+ // ...expands
33+ // }
34+ // }
35+ // delete config.params.expandList
36+ // }
3937
4038 return config
4139 } ,
0 commit comments