Skip to content

Instantly share code, notes, and snippets.

@FabricioFFC
Created July 27, 2018 23:54
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/b3e5c09f0cfb88b19f2326b894001e37 to your computer and use it in GitHub Desktop.
Save FabricioFFC/b3e5c09f0cfb88b19f2326b894001e37 to your computer and use it in GitHub Desktop.
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