Skip to content

Commit

Permalink
Merge pull request #626 from RobertRad/fix-errors-when-token-is-undef…
Browse files Browse the repository at this point in the history
…ined

Be sure to handle `undefined` tokens.
  • Loading branch information
Steve Hobbs authored Oct 28, 2019
2 parents 0e1aae9 + 6d85f53 commit 74d0d45
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/jwthelper.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class JwtHelperService {
}

public decodeToken(token: string = this.tokenGetter()): any {
if(token == null || token === '') {
if (!token || token === '') {
return null;
}

Expand Down Expand Up @@ -112,7 +112,7 @@ export class JwtHelperService {
}

public isTokenExpired(token: string = this.tokenGetter(), offsetSeconds?: number): boolean {
if (token == null || token === '') {
if (!token || token === '') {
return true;
}
let date = this.getTokenExpirationDate(token);
Expand Down

0 comments on commit 74d0d45

Please sign in to comment.