lakesare / memcode

Spaced-repetition: with real formatting.
http://memcode.com
MIT License
335 stars 72 forks source link

WIP: Make sure we get user's email from Github! #33 #57

Closed anandvenkat4 closed 4 years ago

anandvenkat4 commented 4 years ago

Fixed the email update.

lakesare commented 4 years ago

Looks good to me! A little nitpick, - it's hard to read, we could refactor it into:

const fetchProfile = fetch('https://api.github.com/user', ...);
const fetchEmail = fetch('https://api.github.com/user/emails', ...);

Promise.all([fetchProfile, fetchEmail])
  .then([profile, emails] => {
    const email = emails[0];
    profile.email = email;
    return profile;
  })
anandvenkat4 commented 4 years ago

Looks good to me! A little nitpick, - it's hard to read, we could refactor it into:

const fetchProfile = fetch('https://api.github.com/user', ...);
const fetchEmail = fetch('https://api.github.com/user/emails', ...);

Promise.all([fetchProfile, fetchEmail])
  .then([profile, emails] => {
    const email = emails[0];
    profile.email = email;
    return profile;
  })

Should I go ahead and make the changes?

lakesare commented 4 years ago

Perfect, merging 💟