Skip to content

Instantly share code, notes, and snippets.

@fredriccliver
Last active September 17, 2020 11:12
Show Gist options
  • Save fredriccliver/bcc38c6d946f99ecc5c22f802cb26638 to your computer and use it in GitHub Desktop.
Save fredriccliver/bcc38c6d946f99ecc5c22f802cb26638 to your computer and use it in GitHub Desktop.
exports.getUsers = functions.https.onCall((data, context) => {
return new Promise((resolve, reject) => {
db.collection("users")
.get()
.then((snapshot) => {
if(snapshot.empty){
reject({msg: "There is no users at all"})
}
data = snapshot.docs.map(doc => doc.data())
resolve(data)
})
.catch((err) => {
reject(err)
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment