Skip to content
Discussion options

You must be logged in to vote
const fetcher = (url) => {
// miss return statement here 
return axios.get(url)
    .then((response) => {
      console.log(response)
      return response.data.results.json()
    })
    .catch(function (error) {
      let textError = ""
      if (error.response) {
        textError = error.response.data.message
      } else if (error.request) {
        textError = error.request
      } else {
        textError = error.message
      }
      const errorThw = new Error(textError)
      errorThw.message = textError
      errorThw.info = error
      errorThw.status = error.status
      return errorThw
    })
}

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
4 replies
@crismarucci
Comment options

@huozhi
Comment options

@crismarucci
Comment options

@huozhi
Comment options

Comment options

You must be logged in to vote
1 reply
@crismarucci
Comment options

Answer selected by crismarucci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants