Last active
September 17, 2020 11:12
-
-
Save fredriccliver/bcc38c6d946f99ecc5c22f802cb26638 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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