I have created an axios interceptor:
instance.interceptors.response.use(async (response) => {
return response.data;
}, (err) => {
return Promise.reject(err);
});
which gets the response and returns the data property.
The response object is of type AxiosResponse<any, any> and the data property is just the data of the type AxiosResponse<any, any>.data.
The problem is that when I use this axios client
const instance = axios.create({...});
// ...etc
// add interceptor
then I do:
customAxiosClient.get().then((data: /* here data is of type AxiosResponse instead of AxiosResponse.data */)
How to solve this ?