Skip to content

Instantly share code, notes, and snippets.

@netgfx
Last active July 27, 2018 10:42
Show Gist options
  • Select an option

  • Save netgfx/605b518289d2124e3fa666f73de1db03 to your computer and use it in GitHub Desktop.

Select an option

Save netgfx/605b518289d2124e3fa666f73de1db03 to your computer and use it in GitHub Desktop.
medium-pending-challenge-3
var pendingChallenges = [];
FirebaseAPI.db.collection("pendingChallenges").where("pendingParty.id", "==", facebookStuff.userId).get().then(function(pendingChallengesDoc) {
console.log(pendingChallengesDoc, pendingChallengesDoc.size);
if (pendingChallengesDoc.empty === true && pendingChallengesDoc.size > 0) {
if (fn) {
fn(pendingChallenges);
}
} else {
pendingChallengesDoc.forEach(function(item) {
pendingChallenges.push(item);
});
if (fn) {
fn(pendingChallenges);
}
}
}).catch(function(err) {
if (fn) {
fn([]);
}
console.log("error: ", err.message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment