I’m using Firebase Web, and am trying to get both a Firestore (database) query and a Storage query (from a field in the Firestore document).
This is currently what I’m working with:
let product = products.where('productID', '==', query).get()
.then(querySnapshot => {
querySnapshot.forEach(doc => {
return {
name: doc.data().name,
desc: doc.data().desc,
price: doc.data().price,
id: doc.data().productID
};
})
})
.catch(e => {
console.log(e);
});
console.log(product);
The problem is that I need the product to be an object outside the promise and don’t know how to achieve that.
JS Console Log:
Promise {}
[[PromiseStatus]]: “resolved”
[[PromiseValue]]: undefined
Thanks for the help