2
0
mirror of synced 2025-01-12 07:04:21 +00:00

[auth] Fix possible race condition #980

This commit is contained in:
Chris Bianca 2018-04-26 09:21:10 +01:00
parent 9914dd1ea4
commit 7cc7d5afe5

View File

@ -103,16 +103,16 @@ export default class Auth extends ModuleBase {
} }
_setUser(user: ?NativeUser): ?User { _setUser(user: ?NativeUser): ?User {
this._authResult = true;
this._user = user ? new User(this, user) : null; this._user = user ? new User(this, user) : null;
this._authResult = true;
SharedEventEmitter.emit(getAppEventName(this, 'onUserChanged'), this._user); SharedEventEmitter.emit(getAppEventName(this, 'onUserChanged'), this._user);
return this._user; return this._user;
} }
_setUserCredential(userCredential: NativeUserCredential): UserCredential { _setUserCredential(userCredential: NativeUserCredential): UserCredential {
const user = new User(this, userCredential.user); const user = new User(this, userCredential.user);
this._authResult = true;
this._user = user; this._user = user;
this._authResult = true;
SharedEventEmitter.emit(getAppEventName(this, 'onUserChanged'), this._user); SharedEventEmitter.emit(getAppEventName(this, 'onUserChanged'), this._user);
return { return {
additionalUserInfo: userCredential.additionalUserInfo, additionalUserInfo: userCredential.additionalUserInfo,