Skip to content

Commit aa5bd1f

Browse files
author
Kim Maida
committed
Minor code cleanup.
1 parent c9522a2 commit aa5bd1f

File tree

3 files changed

+2
-12
lines changed

3 files changed

+2
-12
lines changed

ng2auth/src/app/app-routing.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NgModule } from '@angular/core';
2-
import { Routes, RouterModule, CanActivate } from '@angular/router';
2+
import { Routes, RouterModule } from '@angular/router';
33
import { CallbackComponent } from './callback.component';
44
import { PublicDealsComponent } from './public-deals/public-deals.component';
55
import { PrivateDealsComponent } from './private-deals/private-deals.component';

ng2auth/src/app/auth/auth.service.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff 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 {

ng2auth/src/app/deal.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
22
import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http';
33
import { Observable } from 'rxjs/Observable';
44
import { catchError } from 'rxjs/operators';
5+
import 'rxjs/add/observable/throw';
56
import { AuthService } from './auth/auth.service';
67

78
@Injectable()

0 commit comments

Comments
 (0)