angularfire
angularfire copied to clipboard
Auth toPromise() didn't work.
When I subscribe for authentication it works pretty well:
this.authService.af.auth.subscribe(auth => { console.log(auth); // works as expected });
bu if I use toPromise(), the callback is never called;
this.authService.af.auth.toPromise().then(auth => { console.log(auth); // this line is never called; });
What am I doing wrong?
Thanks!
It looks like that the method has not been (yet) implemented in this object. If you want to perform a action just once you might try to unsubscribe in the first response:
this.af.auth.subscribe( authData =>{
//do stuff
this.af.auth.unsubscribe();
});
That said, I'm gonna close this issue.
Thank you.