8

I am trying to use axios in React chrome extension module, but I am facing this issue.

Uncaught (in promise) Error: Error: Adapter 'http' is not available in the build

// background.ts

import axios from "axios"
...
axios.get<SerInyResponse>("https://realtor.p.rapidapi.com/locations/v2/auto-complete")
            .then(response => {
                this.Storage.setLocalStorage(response.data).then( (re) => {
                    resolve(response.data.Listeners)
                })
                
            })
            .catch( err => {
                reject(new Error(err))
            })

Can anyone help me?

DotNetStar A
  • 123
  • 1
  • 7

2 Answers2

4

Write with Fetch

const res = await fetch(url, { method: "GET", credentials: "include", headers: { Cookie: token }, });

HoFa
  • 101
  • 5
3

service workers only support fetch

ani chan
  • 51
  • 5