You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Awesome job on your course! Still enjoying watching!
It got me motivated to build something similar, where I found a small issue;
Whenever I log in, the AuthService has; get user() { return this.af.auth.currentUser; }
But it returns just an Object, After logging into another account, the AuthService (as it is singular) doesn't update this .currentUser property. It keeps track of my previous account.
In MealsService (also singular); meals$: Observable<Meal[]> = this.db.list(meals/${this.uid}`)
get uid() {
console.log(this.authService.user.uid)
return this.authService.user.uid; // still returns old UID
}
`
There will be an exception that the newly logged in user is not permitted to access the firebase.db.list.
Suggested solution;
In the constructor of the MealsService, listen to the 'authState' object of the AuthService as this returns an Observable<fb.user>. Let me know what you think and if you have a similar issue.
The text was updated successfully, but these errors were encountered:
Hey Todd!
Awesome job on your course! Still enjoying watching!
It got me motivated to build something similar, where I found a small issue;
Whenever I log in, the AuthService has;
get user() { return this.af.auth.currentUser; }
But it returns just an Object, After logging into another account, the AuthService (as it is singular) doesn't update this .currentUser property. It keeps track of my previous account.
In MealsService (also singular);
meals$: Observable<Meal[]> = this.db.list(
meals/${this.uid}`)get uid() {
console.log(this.authService.user.uid)
return this.authService.user.uid; // still returns old UID
}
`
There will be an exception that the newly logged in user is not permitted to access the firebase.db.list.
Suggested solution;
In the constructor of the MealsService, listen to the 'authState' object of the AuthService as this returns an Observable<fb.user>. Let me know what you think and if you have a similar issue.
The text was updated successfully, but these errors were encountered: