Replies: 1 comment
-
@Senderek Im using Axios in WXT and not running into any problems but we also don't use
If you need it to be dynamic, you can also use As I was writing this I think I see your problem tho 🤔 axios.defaults.headers["Content-Type"] = "application/json"; should be: axios.defaults.headers.common["Content-Type"] = "application/json"; https://github.com/axios/axios?tab=readme-ov-file#config-defaults |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to move my project from plasmo to wxt.
In the project I am extensively using axios for api calls.
Unfortunately I am getting an error when trying to use axios.defaults setup. Is that something not allowed in wxt?
Error:
Steps to reproduce:
npx wxt@latest init
npm install axios@latest
oryarn add axios
)background.ts
: lines that seems to break it areaxios.defaults.headers["Content-Type"] = "application/json"
(any other interaction with defaults does that as well e.g.axios.defaults.transformResponse[...]
) ortype Api = ReturnType<typeof createApi>;
yarn run postinstall
background.ts
Beta Was this translation helpful? Give feedback.
All reactions