フェデレーテッド Google サインインが成功した後、またはユーザーがサインイン状態になった後、認証後に isAuthenticated:boolean を True に設定したいと考えています。
import {Injectable} from '@angular/core';
import {AngularFire} from 'angularfire2';
import {Observable} from 'rxjs/Observable';
//this current code is not making sense. Any suggestion
//to make it an Observable for Signin and Logout?
@Injectable()
export class AuthService {
isAuthenticated:boolean = false;
authObj: Observable<any>;
constructor(public af:AngularFire) {
this.authObj = af.auth;
}
signin() {
//I want to make AngularFire2 Authentication token/obj an Observable. So this will keep emitting an Observable
//that return True.... after successful Federated Google Signin. I want my other component to subscribe to this Observable.
return this.authObj.do(val => this.af.auth.login());
this.isAuthenticated = true;
}
}