Skip to content

Commit b4b515c

Browse files
committed
Added userSignedIn() method. Fixes #24
1 parent a813313 commit b4b515c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ constructor(private _tokenService: Angular2TokenService) {
104104
105105
globalOptions: {
106106
headers: {
107-
'Content-Type': 'application/json',
108-
'Accept': 'application/json'
107+
'Content-Type': 'application/json',
108+
'Accept': 'application/json'
109109
}
110110
}
111111
});

src/angular2-token.service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,12 @@ export class Angular2TokenService implements CanActivate {
4444
private _router: Router
4545
) { }
4646

47+
userSignedIn(): boolean {
48+
return !!this._currentAuthData;
49+
}
50+
4751
canActivate() {
48-
if (this._currentUserData)
52+
if (this.userSignedIn())
4953
return true;
5054
else {
5155

0 commit comments

Comments
 (0)