@@ -268,26 +268,22 @@ import * as firebase from 'firebase/app';
268
268
269
269
@Injectable ()
270
270
export class AuthService {
271
- private authState: Observable <firebase .User >;
272
271
private currentUser: firebase .User ;
273
272
274
273
constructor (public afAuth : AngularFireAuth ) {
275
- this .authState = afAuth .authState ;
276
- afAuth .subscribe ((user : firebase .User ) => {
277
- this .currentUser = user ;
278
- });
274
+ afAuth .authState .subscribe ((user : firebase .User ) => this .currentUser = user );
279
275
}
280
276
281
277
get authenticated(): boolean {
282
278
return this .currentUser !== null ;
283
279
}
284
280
285
- signInWithFacebook(): firebase .Promise <FirebaseAuthState > {
281
+ signInWithFacebook(): firebase .Promise <any > {
286
282
return this .afAuth .auth .signInWithPopup (new firebase .auth .FacebookAuthProvider ());
287
283
}
288
284
289
285
signOut(): void {
290
- this .afAuth .signOut ();
286
+ this .afAuth .auth . signOut ();
291
287
}
292
288
293
289
displayName(): string {
@@ -478,21 +474,17 @@ import { Facebook } from 'ionic-native';
478
474
479
475
@Injectable ()
480
476
export class AuthService {
481
- private authState: Observable <firebase .User >;
482
477
private currentUser: firebase .User ;
483
478
484
479
constructor (public afAuth : AngularFireAuth ) {
485
- this .authState = afAuth .authState ;
486
- afAuth .subscribe ((user : firebase .User ) => {
487
- this .currentUser = user ;
488
- });
480
+ afAuth .authState .subscribe ((user : firebase .User ) => this .currentUser = user );
489
481
}
490
482
491
483
get authenticated(): boolean {
492
484
return this .currentUser !== null ;
493
485
}
494
486
495
- signInWithFacebook(): firebase .Promise <FirebaseAuthState > {
487
+ signInWithFacebook(): firebase .Promise <any > {
496
488
if (this .platform .is (' cordova' )) {
497
489
return Facebook .login ([' email' , ' public_profile' ]).then (res => {
498
490
const facebookCredential = firebase .auth .FacebookAuthProvider .credential (res .authResponse .accessToken );
@@ -505,7 +497,7 @@ export class AuthService {
505
497
}
506
498
507
499
signOut(): void {
508
- this .afAuth .signOut ();
500
+ this .afAuth .auth . signOut ();
509
501
}
510
502
511
503
displayName(): string {
0 commit comments