I have this code below that I uploaded as a firebase function. whenever I checked the logs using firebase functions:log, I can see that the expoTokens array is empty.
var expoTokens = [];
db.collection('members').get()
.then(docs => {
var data = []
docs.forEach(doc => {
if (recipients.includes(doc.id)) {
doc.data().expoTokens.forEach(token => {
if (!data.includes(token)) data.push(token);
})
}
})
return Promise.all(data);
})
.then((data) => {
expoTokens = data;
})
console.log("expoTokens");
console.log(expoTokens);
What I only need is to get an array of ExpoTokens so I can send notification.