I am using axios "axios": "^0.25.0", in the google chrome exstension(manifest V3), because using fetch we should implement the interceptor by yourself. Now show when I run a post in google chrome extension shows this error message:
TypeError: adapter is not a function
at dispatchRequest (background.js:836:10)
at Axios.request (background.js:599:15)
at Axios.post (background.js:634:17)
at Function.wrap [as post] (background.js:1276:15)
at do_post (background.js:2418:50)
at handleTransImpl (background.js:2370:72)
at handleMessage (background.js:2551:94)
at background.js:2546:5
I searching from internet that found the axios using XHLHTTPRequest by defualt. Is it possible to make it using fetch by default. what should I do to make the axios support the google chrome extension? this is the http request code:
export function do_post(url:string,data:any){
axios.post(url, JSON.stringify(data))
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
}