user7871794
user7871794

Reputation: 51

Fetch error (evaluating 'input.bodyUsed')

In the code below, I don't get the response and get an undefined error instead.

undefined error

fetchData() {
  fetch(Global.user_list)
    .then((response) => {
      if (response.ok) {
        return response.json()
      } 
    })
    .then((data) => {})
    .catch((err)=> {
      alert(err)
    })
}

Upvotes: 0

Views: 765

Answers (1)

guevaraf
guevaraf

Reputation: 71

I got the same exception by chance. I was doing a refactoring and failed to provide a valid url to the fetch function.

So I would recommend you check what is inside Global.user_list .

Upvotes: 6

Related Questions