Skip to content

Instantly share code, notes, and snippets.

@vinicius73
Created April 9, 2017 15:00
Show Gist options
  • Save vinicius73/fa7dc4ac9d3dc0d106ca875503a58f11 to your computer and use it in GitHub Desktop.
Save vinicius73/fa7dc4ac9d3dc0d106ca875503a58f11 to your computer and use it in GitHub Desktop.
const parseResponse = ({ data }) => {
if (data.error === true) {
return Promise.reject(data)
}
return data
}
const http = axios.create({ })
http.interceptors.response.use(parseResponse, error => Promise.reject(error))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment