Created
April 9, 2017 15:00
-
-
Save vinicius73/fa7dc4ac9d3dc0d106ca875503a58f11 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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