Closed Jaimeer closed 6 years ago
Thanks for submitting this issue!!
The bind
function already returns a promise, you can simply trigger that manually.
this.$binding("users", firebase.firestore().collection("users"))
.then((users) => {
console.log(users) // => __ob__: Observer
}).catch(error) => {
console.error(error.message)
}
Hi, that only works if the problem is with the docChanges.forEach
source.onSnapshot(doc => {
doc.docChanges.forEach(snapshot => {
...
}, error => {
reject(error)
})
})
}
You should add a new reject in onSnapshot
source.onSnapshot(doc => {
doc.docChanges.forEach(snapshot => {
...
}, error => {
reject(error)
})
}, error => { // <-- New reject
reject(error)
})
}
The same for the documents
source.onSnapshot(doc => {
...
}, error => { // <-- New reject
reject(error)
})
You can test it trying to access a collection in firestore where you don't have permissions
Regards @
Without the extra reject if you try the next code and receive an "Error: Missing or insufficient permissions.":
component
.$binding('tests', firebase.db.collection('tests'))
.then(tests => {
...
})
.catch(error => {
// Not enter
})
Regards
Fixed!! Thanks :+1:
Please can you add reject in onSnapshot error in functions "collections" and "documents" to be able to detect for example "permission-denied" errors
Thanks