Skip to content

Instantly share code, notes, and snippets.

@diego3g
Created December 18, 2017 15: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 diego3g/2081d1a1038489e3c4006c16bf10685e to your computer and use it in GitHub Desktop.
Save diego3g/2081d1a1038489e3c4006c16bf10685e to your computer and use it in GitHub Desktop.
// Modelo antigo (ES6)
function fetchUser(user) {
api.get(`/users/${user}`).then(response => {
console.log(response);
});
}
// Novo modelo (ES8)
async function fetchUser(user) {
const response = await api.get(`/users/${user}`);
console.log(response);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment