import axios , { AxiosRequestConfig } from 'axios' ; export const getWithResponseType = < T > ( config ) : Promise < T > => { const source = axios . CancelToken . source ( ) ; const promise = axios ( { ... config , cancelToken : source . token } ) . then ( ( { data } ) => data ) ; promise . cancel = ( ) => { source . cancel ( 'Query was cancelled by React Query' ) ; } ; return promise ; } ; export default getWithResponseType ;