Created
July 27, 2018 23:54
-
-
Save FabricioFFC/b3e5c09f0cfb88b19f2326b894001e37 to your computer and use it in GitHub Desktop.
This file contains 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 axios = require('axios'); | |
async function get(url) { | |
try { | |
const response = await axios.get(url); | |
return response.data; | |
} catch ({ response }) { | |
return { | |
status: response.status, | |
error: response.data, | |
}; | |
} | |
} | |
const httpRequest = { | |
get, | |
}; | |
export default httpRequest; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment