You can add a mutator function to your config and setup a custom instance of axios.
module.exports = {petstore: {output: {...override: {mutator: {path: './api/mutator/custom-instance.ts',name: 'customInstance',},},}...},};
// custom-instance.tsimport Axios, { AxiosRequestConfig } from 'axios';export const AXIOS_INSTANCE = Axios.create({ baseURL: '<BACKEND URL>' }); // use your own URL here or environment variableexport const customInstance = <T>(config: AxiosRequestConfig): Promise<T> => {const source = Axios.CancelToken.source();const promise = AXIOS_INSTANCE({ ...config, cancelToken: source.token }).then(({ data }) => data,);// @ts-ignorepromise.cancel = () => {source.cancel('Query was cancelled');};return promise;};