From 2762277c60db7df5ad3214b10a0dd93d4f2f1128 Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Fri, 10 Mar 2017 08:53:44 +0000
Subject: [PATCH] #3527 feature - Added more features to angular2 version

---
 securis/src/main/webapp/src/app/common/default.requests.options.ts |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/securis/src/main/webapp/src/app/common/default.requests.options.ts b/securis/src/main/webapp/src/app/common/default.requests.options.ts
index 62dbe13..d02c654 100644
--- a/securis/src/main/webapp/src/app/common/default.requests.options.ts
+++ b/securis/src/main/webapp/src/app/common/default.requests.options.ts
@@ -1,6 +1,15 @@
 import { LocalStorageService } from 'angular-2-local-storage';
 import { Injectable } from '@angular/core';
-import { BaseRequestOptions, RequestOptions, Request, XHRBackend, XHRConnection} from '@angular/http';
+import {
+    BaseRequestOptions,
+    BrowserXhr,
+    Request,
+    RequestOptions,
+    ResponseOptions,
+    XHRBackend,
+    XHRConnection,
+    XSRFStrategy
+} from '@angular/http';
 
 
 // TODO: Chnage this to use Covalent Http helper service
@@ -17,6 +26,7 @@
     let token = this.store.get<string>('token');
     if (token) {
         this.headers.set('X-SECURIS-TOKEN', token);
+        
     }    
     
   }
@@ -24,9 +34,14 @@
 
 @Injectable()
 export class ApiXHRBackend extends XHRBackend {
+    
+    constructor(_browserXHR: BrowserXhr,  _baseResponseOptions: ResponseOptions, _xsrfStrategy: XSRFStrategy) {
+          super(_browserXHR, _baseResponseOptions, _xsrfStrategy);
+    }
+
     createConnection(request: Request): XHRConnection {
-        if (request.url.startsWith('/')){
-           // request.url = '/securis' + request.url;     // prefix base url
+        if (!request.url.endsWith('.js') && !request.url.endsWith('.html') && !request.url.endsWith('.svg')){
+           request.url = 'http://localhost:8080/securis/' + request.url;     // prefix base url
         }
         return super.createConnection(request);
     }

--
Gitblit v1.3.2