Skip to content

Commit

Permalink
Use RequestOptions to avoid TS error
Browse files Browse the repository at this point in the history
  • Loading branch information
chenkie committed Nov 11, 2015
1 parent ad8f538 commit eb195c1
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 50 deletions.
8 changes: 3 additions & 5 deletions angular2-jwt.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 27 additions & 31 deletions src/angular2-jwt.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/angular2-jwt.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 14 additions & 13 deletions src/angular2-jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,32 @@ export class AuthHttp {

request(method:RequestMethods, url:string, body?:string) {

var options = new RequestOptions({
method: method,
url: url,
body: body,
});

if(!tokenNotExpired(null, this._config.tokenGetter())) {
if(this._config.noJwtError) {
return this.http.request(new Request({
method: method,
url: url,
body: body,
headers: null,
search: null,
merge: null
}));
return this.http.request(new Request(options));
}

throw 'Invalid JWT';
}

var authHeader = new Headers();

authHeader.append(this._config.headerName, this._config.headerPrefix + this._config.tokenGetter());
return this.http.request(new Request({

var authOptions = new RequestOptions({
method: method,
url: url,
body: body,
headers: authHeader,
search: null,
merge: null
}));
headers: authHeader
});

return this.http.request(new Request(authOptions));

}

Expand Down

0 comments on commit eb195c1

Please sign in to comment.