2017-02-22 18:13:21 +00:00
|
|
|
// #docregion
|
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
|
|
|
|
import { Observable } from 'rxjs/Observable';
|
|
|
|
import 'rxjs/add/observable/of';
|
|
|
|
import 'rxjs/add/operator/do';
|
|
|
|
import 'rxjs/add/operator/delay';
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class AuthService {
|
2017-05-03 19:31:02 +02:00
|
|
|
isLoggedIn = false;
|
2017-02-22 18:13:21 +00:00
|
|
|
|
|
|
|
// store the URL so we can redirect after logging in
|
|
|
|
redirectUrl: string;
|
|
|
|
|
|
|
|
login(): Observable<boolean> {
|
|
|
|
return Observable.of(true).delay(1000).do(val => this.isLoggedIn = true);
|
|
|
|
}
|
|
|
|
|
|
|
|
logout(): void {
|
|
|
|
this.isLoggedIn = false;
|
|
|
|
}
|
|
|
|
}
|