Skip to content

Commit f12e5a4

Browse files
authored
docs: Correcting errors in methods and types
1 parent e35cd24 commit f12e5a4

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

docs/Auth-with-Ionic2.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -268,26 +268,22 @@ import * as firebase from 'firebase/app';
268268

269269
@Injectable()
270270
export class AuthService {
271-
private authState: Observable<firebase.User>;
272271
private currentUser: firebase.User;
273272

274273
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);
279275
}
280276

281277
get authenticated(): boolean {
282278
return this.currentUser !== null;
283279
}
284280

285-
signInWithFacebook(): firebase.Promise<FirebaseAuthState> {
281+
signInWithFacebook(): firebase.Promise<any> {
286282
return this.afAuth.auth.signInWithPopup(new firebase.auth.FacebookAuthProvider());
287283
}
288284

289285
signOut(): void {
290-
this.afAuth.signOut();
286+
this.afAuth.auth.signOut();
291287
}
292288

293289
displayName(): string {
@@ -478,21 +474,17 @@ import { Facebook } from 'ionic-native';
478474

479475
@Injectable()
480476
export class AuthService {
481-
private authState: Observable<firebase.User>;
482477
private currentUser: firebase.User;
483478

484479
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);
489481
}
490482

491483
get authenticated(): boolean {
492484
return this.currentUser !== null;
493485
}
494486

495-
signInWithFacebook(): firebase.Promise<FirebaseAuthState> {
487+
signInWithFacebook(): firebase.Promise<any> {
496488
if (this.platform.is('cordova')) {
497489
return Facebook.login(['email', 'public_profile']).then(res => {
498490
const facebookCredential = firebase.auth.FacebookAuthProvider.credential(res.authResponse.accessToken);
@@ -505,7 +497,7 @@ export class AuthService {
505497
}
506498

507499
signOut(): void {
508-
this.afAuth.signOut();
500+
this.afAuth.auth.signOut();
509501
}
510502

511503
displayName(): string {

0 commit comments

Comments
 (0)