1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
| import axios from 'axios'
|
| axios.defaults.baseURL = process.env.BASE_API
|
| const service = axios.create({
| timeout: 40000,
| headers: {
| 'X-Requested-With': 'XMLHttpRequest',
| 'Content-Type': 'application/json; charset=UTF-8'
| }
| })
| service.interceptors.request.use(
| config => {
| return config
| },
| error => {
| Promise.reject(error)
| }
| )
|
| // response interceptor
| service.interceptors.response.use(
| response => {
| const res = response.data
| return res
| },
| () => {
| }
| )
| export default service
|
|