Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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