mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-23 07:19:50 -04:00
fix minor issues with login
This commit is contained in:
parent
5cfc34a1f2
commit
f767cb4b85
@ -1,4 +1,4 @@
|
||||
{
|
||||
"printWidth": 120,
|
||||
"singleQuote": false
|
||||
"singleQuote": true
|
||||
}
|
||||
|
@ -62,8 +62,8 @@ export class ProfileService {
|
||||
console.log('Saving the remote profile...');
|
||||
self.remoteProfile.ref.set(self.localProfile);
|
||||
console.log(' Finished saving remote profile. ' + self.elapsed(st, new Date()) + 'ms');
|
||||
self.needsSync = false;
|
||||
}
|
||||
self.needsSync = false;
|
||||
}
|
||||
|
||||
poll(self);
|
||||
@ -80,7 +80,9 @@ export class ProfileService {
|
||||
this.onLocalStorageLoaded.emit(this.localProfile);
|
||||
});
|
||||
|
||||
this.firebaseAuth.authState.subscribe(state => this.subscribeToRemoteProfile(this.db, state));
|
||||
this.firebaseAuth.authState.subscribe(state => {
|
||||
this.subscribeToRemoteProfile(this.db, state);
|
||||
});
|
||||
}
|
||||
|
||||
addSearchRequestToHistory(qry: string) {
|
||||
@ -141,6 +143,14 @@ export class ProfileService {
|
||||
}
|
||||
|
||||
subscribeToRemoteProfile(db: AngularFireDatabase, user: firebase.User) {
|
||||
// if this is a logout.
|
||||
if (user === null) {
|
||||
console.log('user signed out from FireBase');
|
||||
this.remoteProfile = null; // inform the profile service not to bother
|
||||
this.remoteLoggedIn = false;
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('subscribeToRemoteProfile');
|
||||
if (!user || this.firebaseUser) return;
|
||||
console.log('You got the firebase user.');
|
||||
@ -208,8 +218,6 @@ export class ProfileService {
|
||||
|
||||
authenticate() {
|
||||
console.log('Authenticating to remote...');
|
||||
|
||||
let self = this;
|
||||
let provider = new firebase.auth.GoogleAuthProvider();
|
||||
if (this.isWeb) {
|
||||
this.firebaseAuth.auth.signInWithPopup(provider);
|
||||
@ -225,7 +233,6 @@ export class ProfileService {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
this.firebaseAuth.authState.subscribe(state => this.subscribeToRemoteProfile(this.db, state));
|
||||
this.remoteLoggedIn = true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user