From f12e5a40a2a60ff3bf80e9bee55bdc75ef348555 Mon Sep 17 00:00:00 2001 From: Mark Goho Date: Wed, 10 May 2017 10:46:36 -0400 Subject: [PATCH] docs: Correcting errors in methods and types --- docs/Auth-with-Ionic2.md | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/docs/Auth-with-Ionic2.md b/docs/Auth-with-Ionic2.md index 02c8eda61..adb781d68 100644 --- a/docs/Auth-with-Ionic2.md +++ b/docs/Auth-with-Ionic2.md @@ -268,26 +268,22 @@ import * as firebase from 'firebase/app'; @Injectable() export class AuthService { - private authState: Observable; private currentUser: firebase.User; constructor(public afAuth: AngularFireAuth) { - this.authState = afAuth.authState; - afAuth.subscribe((user: firebase.User) => { - this.currentUser = user; - }); + afAuth.authState.subscribe((user: firebase.User) => this.currentUser = user); } get authenticated(): boolean { return this.currentUser !== null; } - signInWithFacebook(): firebase.Promise { + signInWithFacebook(): firebase.Promise { return this.afAuth.auth.signInWithPopup(new firebase.auth.FacebookAuthProvider()); } signOut(): void { - this.afAuth.signOut(); + this.afAuth.auth.signOut(); } displayName(): string { @@ -478,21 +474,17 @@ import { Facebook } from 'ionic-native'; @Injectable() export class AuthService { - private authState: Observable; private currentUser: firebase.User; constructor(public afAuth: AngularFireAuth) { - this.authState = afAuth.authState; - afAuth.subscribe((user: firebase.User) => { - this.currentUser = user; - }); + afAuth.authState.subscribe((user: firebase.User) => this.currentUser = user); } get authenticated(): boolean { return this.currentUser !== null; } - signInWithFacebook(): firebase.Promise { + signInWithFacebook(): firebase.Promise { if (this.platform.is('cordova')) { return Facebook.login(['email', 'public_profile']).then(res => { const facebookCredential = firebase.auth.FacebookAuthProvider.credential(res.authResponse.accessToken); @@ -505,7 +497,7 @@ export class AuthService { } signOut(): void { - this.afAuth.signOut(); + this.afAuth.auth.signOut(); } displayName(): string {