angular - Property 'currentUser' does not exist on type 'FirebaseAuthState' -
trying currentuser in angularfire2. type exposes this?
https://firebase.google.com/docs/reference/js/firebase.auth.auth
it's not obvious me exploring observable:
constructor(private auth: firebaseauth) { auth.subscribe((user) => console.log('user is', user)); }
the user
object receive firebaseauth
observable contains following properties:
provider
uid
auth
the last of these - auth
- currentuser
. if @ source, can see auth
property firebase user
.
you can verify using instanceof
:
constructor(private auth: firebaseauth) { auth.subscribe( (user) => { if (user) { console.log('user.auth user instance = ' + (currentuser instanceof firebase.user)); let currentuser = user.auth; // ... } else { console.log('no user signed in'); } } ); }
Comments
Post a Comment