Skip to content

Instantly share code, notes, and snippets.

@FabricioFFC
Created August 25, 2018 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FabricioFFC/07be4991bfda04590ff78aa5b35f1899 to your computer and use it in GitHub Desktop.
Save FabricioFFC/07be4991bfda04590ff78aa5b35f1899 to your computer and use it in GitHub Desktop.
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