Skip to content

Commit

Permalink
stop adding token header for other services
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Grove committed Mar 8, 2017
1 parent b4978e9 commit 3212f2b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/app/services/http-client.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,32 @@ export class HttpClient {
constructor(private http: Http) {}

createAuthorizationHeader(headers: Headers) {
console.log(window.location);
if (typeof window['_g_ck'] !== 'undefined' && window['_g_ck'] !== '') {
headers.append('X-UserToken', window['_g_ck']);
}
}

get(url,options = new RequestOptions) {
options.headers = new Headers();
this.createAuthorizationHeader(options.headers);
if (/^\/api/.test(url)) this.createAuthorizationHeader(options.headers);
return this.http.get(url,options);
}

post(url, data, options = new RequestOptions) {
let headers = new Headers();
this.createAuthorizationHeader(headers);
if (/^\/api/.test(url)) this.createAuthorizationHeader(options.headers);
return this.http.post(url, data, options);
}

put(url, data, options = new RequestOptions) {
let headers = new Headers();
this.createAuthorizationHeader(headers);
if (/^\/api/.test(url)) this.createAuthorizationHeader(options.headers);
return this.http.put(url, data, options);
}

delete(url, options = new RequestOptions) {
let headers = new Headers();
this.createAuthorizationHeader(headers);
if (/^\/api/.test(url)) this.createAuthorizationHeader(options.headers);
return this.http.delete(url, options);
}
}

0 comments on commit 3212f2b

Please sign in to comment.