Skip to content

Instantly share code, notes, and snippets.

@MikeFielden
Created September 10, 2020 17:50
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 MikeFielden/b42e4b96800ca70d2c63b3e408e5411a to your computer and use it in GitHub Desktop.
Save MikeFielden/b42e4b96800ca70d2c63b3e408e5411a to your computer and use it in GitHub Desktop.
function Api() {}
Api.prototype.fetchUsers = async function () {
const users = await getUsersFromApi();
return users;
};
Api.prototype.fetchProfileImg = async function (user) {
const profileImg = await getProfileImgFromUser(user);
return profileImg;
};
const api = new Api();
const users = await api.fetchUsers();
const profileImg = await api.fetchProfileImg(users[0]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment