Skip to content

Commit 87760cc

Browse files
committed
added auth listener before calling listen
1 parent 19018c1 commit 87760cc

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

lib/modules/auth.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,17 @@ export default class Auth extends Base {
2424
// start listening straight away
2525
// generally though the initial event fired will get ignored
2626
// but this is ok as we fake it with the getCurrentUser below
27+
FirestackAuthEvt.addListener('listenForAuth', this._onAuthStateChanged.bind(this));
2728
FirestackAuth.listenForAuth();
2829

2930
this.getCurrentUser().then((u: Object) => {
3031
this._onAuthStateChanged({ authenticated: !!u, user: u || null });
31-
this._startListening();
3232
}).catch(() => {
3333
// todo check if error contains user disabled message maybe and add a disabled flag?
3434
this._onAuthStateChanged({ authenticated: false, user: null });
35-
this._startListening();
3635
});
3736
}
3837

39-
/**
40-
* Internal function begin listening for auth changes
41-
* only called after getting current user.
42-
* @private
43-
*/
44-
_startListening() {
45-
FirestackAuthEvt.addListener('listenForAuth', this._onAuthStateChanged.bind(this));
46-
}
47-
4838
/**
4939
* Internal auth changed listener
5040
* @param auth

0 commit comments

Comments
 (0)