mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-28 20:25:41 +08:00
[js][auth] onAuthStateChange now correctly returns an instance of the User class.
This commit is contained in:
@@ -42,12 +42,7 @@ export default class Auth extends Base {
|
|||||||
if (auth && auth.user && !this._user) this._user = new User(this, auth);
|
if (auth && auth.user && !this._user) this._user = new User(this, auth);
|
||||||
else if ((!auth || !auth.user) && this._user) this._user = null;
|
else if ((!auth || !auth.user) && this._user) this._user = null;
|
||||||
else if (this._user) this._user._updateValues(auth);
|
else if (this._user) this._user._updateValues(auth);
|
||||||
if (emit) {
|
if (emit) this.emit('onAuthStateChanged', this._user);
|
||||||
this.emit(
|
|
||||||
'onAuthStateChanged',
|
|
||||||
this._authResult && this._authResult.user || null
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return auth ? this._user : null;
|
return auth ? this._user : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user