inertia: Axios breaks with 1.2.0

I’m not sure why or exactly what is happening, but when I update from 0.1.9 to 0.2.0 this code has no effect:

import axios from 'axios'
axios.defaults.xsrfHeaderName = 'X-CSRF-TOKEN'

All of my requests fail due to the header being set to the default X-XSRF-TOKEN (X instead of C)

When I look in node_modules/@inertiajs/inertia I see there is a node_modules folder with it’s own copy of Axios which is what I assume to be the issue, it’s like there are two different Axios modules, one that Inertia is using and one that my code is using.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 21 (11 by maintainers)

Most upvoted comments

Thanks @reinink, I’ve updated all deps and it LGTM! @ledermann you continue to be my hero 😉

Done: https://github.com/inertiajs/inertia/releases/tag/v0.3.2 👍

Hopefully this helps, and hopefully axios@v0.21.0 doesn’t come out soon. 😅