Created
August 25, 2018 20:04
-
-
Save FabricioFFC/07be4991bfda04590ff78aa5b35f1899 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
import axios from 'axios'; | |
import humps from 'humps'; | |
async function get(url) { | |
try { | |
const response = await axios.get(url); | |
return humps.camelizeKeys(response.data); | |
} catch ({ response }) { | |
return { | |
status: response.status, | |
error: humps.camelizeKeys(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