Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CancelToken property not available in custom axios instance #80

Closed
hsz opened this issue Nov 13, 2019 · 3 comments
Closed

CancelToken property not available in custom axios instance #80

hsz opened this issue Nov 13, 2019 · 3 comments
Labels
bug Something isn't working

Comments

@hsz
Copy link
Contributor

hsz commented Nov 13, 2019

After latest update related to the CancelToken, there is an issue with:

cancelSourceRef.current = axiosInstance.CancelToken.source()

Everything works when you use AxiosStatic, imported directly from `axios.
But when you pass your own instance through the options, like:

configure({
  axios: axios.create({
    baseURL: theme.config.api.endpoint,
  }),
});

it is AxiosInstance used which doesn't contain CancelToken property anymore and it ends up with the following error in mentioned line:

TypeError: Cannot read property 'source' of undefined
@simoneb simoneb added the bug Something isn't working label Nov 13, 2019
@arielserafini
Copy link

I've stumbled upon the same issue. Ultimately had to downgrade to 1.5.0.

@simoneb
Copy link
Owner

simoneb commented Nov 13, 2019

Fixed in 1.7.2

@hsz
Copy link
Contributor Author

hsz commented Nov 13, 2019

Commit looks fine, I'll test it tomorrow. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants