(config?: AxiosRequestConfig)
| 54 | private cancelTokenSource: CancelTokenSource |
| 55 | |
| 56 | constructor(config?: AxiosRequestConfig) { |
| 57 | this.cancelTokenSource = axios.CancelToken.source() |
| 58 | this.instance = axios.create({ |
| 59 | baseURL: import.meta.env.VITE_API_BASE_URL, |
| 60 | timeout: 100000, |
| 61 | headers: { |
| 62 | 'Content-Type': 'application/json', |
| 63 | ...config?.headers, |
| 64 | }, |
| 65 | // add transformResponse to bigint |
| 66 | transformResponse: [ |
| 67 | function (data) { |
| 68 | try { |
| 69 | return JSONBig.parse(data) // use JSON-bigint |
| 70 | // eslint-disable-next-line @typescript-eslint/no-unused-vars |
| 71 | } catch (e) { |
| 72 | try { |
| 73 | return JSON.parse(data) |
| 74 | // eslint-disable-next-line @typescript-eslint/no-unused-vars |
| 75 | } catch (parseError) { |
| 76 | return data |
| 77 | } |
| 78 | } |
| 79 | }, |
| 80 | ], |
| 81 | ...config, |
| 82 | }) |
| 83 | |
| 84 | this.setupInterceptors() |
| 85 | } |
| 86 | |
| 87 | /* private cancelCurrentRequest(message: string) { |
| 88 | this.cancelTokenSource.cancel(message) |
nothing calls this directly
no test coverage detected