Комментарии:
Shouldn't we unsubscribe the Database listener when logging out? . Assume the following scenario: within the same session, a user logs in, then logs out, then logs in. Does that mean we are having 2 listeners, one from each login?
ОтветитьYou are a saviour. Every time I pick up some new technology to learn you have got my back as always.
Ответитьthank you so much for these vidoes! I am building an application with Quasar and Firebase. I'm brand new to both of them, this video series is super easy to follow and makes so much sense!
ОтветитьHello , thank you for your course! i have a doubt, why did you get the "insufficient permissions" error when you logged out? shouldn't the user be null at that moment and not reach that part of the code?
ОтветитьHow to delete Guides? reply, please !!!!!!!!!!!!!How to delete Guides? reply, please !!!!!!!!!!!!!How to delete Guides? reply, please !!!!!!!!!!!!!How to delete Guides? reply, please !!!!!!!!!!!!!
How to delete Guides? reply, please !!!!!!!!!!!!!
how to show user name plz help me?
ОтветитьquerySelectoooooorrrrr!!!!
ОтветитьWhen you call the onSnapshot method, it returns an object that you can use to unsubscribe from the listener and prevent the error.
So if you change your onAuthStateHandler to the code below the error won't happen.
let unsubscribe = () => {};
// listen for auth changes
auth.onAuthStateChanged( user => {
if(user){
// get data
unsubscribe = db.collection('guides').onSnapshot(snapshot => {
setupGuides(snapshot.docs);
})
setupUi(user);
} else {
setupGuides([]);
setupUi();
unsubscribe();
}
});
Thanks Shaun
Ответитьbig thank bro
ОтветитьDid you ever notice that when the Net Ninja is typing "querySelector" he sings the "Selector" part? It's not a criticism, it's just interesting what some people do.
Ответитьnow catch is not used callback function for error is used.
db.collection("cities")
.onSnapshot(function(snapshot) {
//...
}, function(error) {
//...
});
You have done it again! Yet another perfect explanation and process of some great code. For that, I thank you.
ОтветитьAwesome! I also learned from you how I can handle the error. Thank you very much:)
ОтветитьThank you! I entered the following code.
db.collection('guides').onSnapshot(snapshot => {......}).catch(err => { console.log(err.message); }).
And I received TypeError message. "TypeError: db.collection(...).onSnapshot(...).catch is not a function at Object.auth.onAuthStateChanged.user"
So how to correct it?? ^^
Thanks you Shaun very good tut!...
Ответить