File tree Expand file tree Collapse file tree 3 files changed +2
-12
lines changed Expand file tree Collapse file tree 3 files changed +2
-12
lines changed Original file line number Diff line number Diff line change 11import { NgModule } from '@angular/core' ;
2- import { Routes , RouterModule , CanActivate } from '@angular/router' ;
2+ import { Routes , RouterModule } from '@angular/router' ;
33import { CallbackComponent } from './callback.component' ;
44import { PublicDealsComponent } from './public-deals/public-deals.component' ;
55import { PrivateDealsComponent } from './private-deals/private-deals.component' ;
Original file line number Diff line number Diff line change @@ -18,9 +18,6 @@ export class AuthService {
1818 } ) ;
1919 userProfile : any ;
2020 accessToken : string ;
21- // Create a stream of logged in status to communicate throughout app
22- loggedIn : boolean ;
23- loggedIn$ = new BehaviorSubject < boolean > ( this . loggedIn ) ;
2421
2522 constructor ( private router : Router ) {
2623 // If token not expired, renew token and fetch profile
@@ -32,12 +29,6 @@ export class AuthService {
3229 }
3330 }
3431
35- private _setLoggedIn ( value : boolean ) {
36- // Update login status subject
37- this . loggedIn$ . next ( value ) ;
38- this . loggedIn = value ;
39- }
40-
4132 login ( ) {
4233 // Auth0 authorize request
4334 this . auth0 . authorize ( ) ;
@@ -88,15 +79,13 @@ export class AuthService {
8879 localStorage . setItem ( 'expires_at' , JSON . stringify ( expTime ) ) ;
8980 this . accessToken = authResult . accessToken ;
9081 this . userProfile = profile ;
91- this . _setLoggedIn ( true ) ;
9282 }
9383
9484 logout ( ) {
9585 // Remove tokens and profile and update login status subject
9686 localStorage . removeItem ( 'expires_at' ) ;
9787 this . userProfile = undefined ;
9888 this . accessToken = undefined ;
99- this . _setLoggedIn ( false ) ;
10089 }
10190
10291 get isLoggedIn ( ) : boolean {
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
22import { HttpClient , HttpHeaders , HttpErrorResponse } from '@angular/common/http' ;
33import { Observable } from 'rxjs/Observable' ;
44import { catchError } from 'rxjs/operators' ;
5+ import 'rxjs/add/observable/throw' ;
56import { AuthService } from './auth/auth.service' ;
67
78@Injectable ( )
You can’t perform that action at this time.
0 commit comments