This commit is contained in:
crusader 2018-03-13 14:18:03 +09:00
parent 43582c7199
commit 2281d5fab7
2 changed files with 4 additions and 6 deletions

View File

@ -41,7 +41,9 @@ export class Effects {
() => { () => {
let queryString: string; let queryString: string;
if (this.cookieService.check('AuthToken')) { if (this.cookieService.check('AuthToken')) {
queryString = `AuthToken=${this.cookieService.get('AuthToken')}`; const authToken = this.cookieService.get('AuthToken');
console.log(`AuthToken: ${authToken}`);
queryString = `AuthToken=${authToken}`;
} }
this.rpcClient.connect(queryString); this.rpcClient.connect(queryString);
} }

View File

@ -12,14 +12,10 @@ import 'rxjs/add/observable/throw';
import { RESTError } from '../error'; import { RESTError } from '../error';
export class RESTClient { export class RESTClient {
private readonly httpHeaders: HttpHeaders;
constructor( constructor(
private _baseURL: string, private _baseURL: string,
private _httpClient: HttpClient, private _httpClient: HttpClient,
) { ) {
this.httpHeaders = new HttpHeaders()
.set('Content-Type', 'application/json');
} }
public get httpClient(): HttpClient { public get httpClient(): HttpClient {
@ -39,7 +35,7 @@ export class RESTClient {
reportProgress?: boolean; reportProgress?: boolean;
withCredentials?: boolean; withCredentials?: boolean;
}): Observable<T> { }): Observable<T> {
const headers: HttpHeaders = this.httpHeaders; options.withCredentials = true;
return this._httpClient return this._httpClient
.request(method, Location.joinWithSlash(this._baseURL, entry), options) .request(method, Location.joinWithSlash(this._baseURL, entry), options)