rsanchez
2017-03-10 2762277c60db7df5ad3214b10a0dd93d4f2f1128
securis/src/main/webapp/src/app/common/default.requests.options.ts
....@@ -1,6 +1,15 @@
11 import { LocalStorageService } from 'angular-2-local-storage';
22 import { Injectable } from '@angular/core';
3
-import { BaseRequestOptions, RequestOptions, Request, XHRBackend, XHRConnection} from '@angular/http';
3
+import {
4
+ BaseRequestOptions,
5
+ BrowserXhr,
6
+ Request,
7
+ RequestOptions,
8
+ ResponseOptions,
9
+ XHRBackend,
10
+ XHRConnection,
11
+ XSRFStrategy
12
+} from '@angular/http';
413
514
615 // TODO: Chnage this to use Covalent Http helper service
....@@ -17,6 +26,7 @@
1726 let token = this.store.get<string>('token');
1827 if (token) {
1928 this.headers.set('X-SECURIS-TOKEN', token);
29
+
2030 }
2131
2232 }
....@@ -24,9 +34,14 @@
2434
2535 @Injectable()
2636 export class ApiXHRBackend extends XHRBackend {
37
+
38
+ constructor(_browserXHR: BrowserXhr, _baseResponseOptions: ResponseOptions, _xsrfStrategy: XSRFStrategy) {
39
+ super(_browserXHR, _baseResponseOptions, _xsrfStrategy);
40
+ }
41
+
2742 createConnection(request: Request): XHRConnection {
28
- if (request.url.startsWith('/')){
29
- // request.url = '/securis' + request.url; // prefix base url
43
+ if (!request.url.endsWith('.js') && !request.url.endsWith('.html') && !request.url.endsWith('.svg')){
44
+ request.url = 'http://localhost:8080/securis/' + request.url; // prefix base url
3045 }
3146 return super.createConnection(request);
3247 }