Method
constructor
({
baseURL = '/',
customInterceptor,
}: { baseURL?: string; customInterceptor?: any } = {})
Source from the content-addressed store, hash-verified
| 68 | instance: AxiosInstance; |
| 69 | |
| 70 | constructor({ |
| 71 | baseURL = '/', |
| 72 | customInterceptor, |
| 73 | }: { baseURL?: string; customInterceptor?: any } = {}) { |
| 74 | this.instance = axios.create({ |
| 75 | baseURL, |
| 76 | }); |
| 77 | this.instance.interceptors.request.use(async (request) => { |
| 78 | request.headers = { |
| 79 | ...request.headers, |
| 80 | 'Content-Type': 'application/json', |
| 81 | Accept: 'application/json', |
| 82 | }; |
| 83 | return request; |
| 84 | }); |
| 85 | customInterceptor && |
| 86 | this.instance.interceptors.request.use(customInterceptor); |
| 87 | } |
| 88 | |
| 89 | catchError = (e: { response: any }) => { |
| 90 | const { response } = e; |
Callers
nothing calls this directly
Tested by
no test coverage detected