infinitered / apisauce

Axios + standardized errors + request/response transforms.
MIT License
2.78k stars 184 forks source link

error TypeError: axios.isCancel is not a function #318

Open emanu7478 opened 1 year ago

emanu7478 commented 1 year ago
const axiosApiInstance = axios.create({ baseURL: "YOUR_BASE_URL_HERE" });

const apisauceInstance = create({
  axiosInstance: axiosApiInstance,
  baseURL: "YOUR_BASE_URL_HERE",
});

try {
    const response: ApiResponse<T> = await apisauceInstance.post(
      endpoints[endpointKey],
      requestData
    );
    return response;
  } catch (error: any) {
    throw error;
  }

When I tried the above code it showed the below error

Screenshot 2023-09-06 at 11 35 20 AM

Versions using are "axios": "^1.5.0" and "apisauce": "^3.0.1"

jamonholmgren commented 1 year ago

Can you provide a codesandbox? I wasn't able to replicate.

https://codesandbox.io/s/nervous-perlman-whs2t8?file=/src/index.ts