From 19be37d4112b9c1ff2568af4c652deccd4c0b3c5 Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Mon, 17 Apr 2017 13:15:38 +0000
Subject: [PATCH] #0 enh - Configuring dev mode dynamically
---
securis/src/main/webapp/src/app/common/default.requests.options.ts | 7 ++-----
1 files changed, 2 insertions(+), 5 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 fd8865a..e380531 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
@@ -10,8 +10,7 @@
XHRConnection,
XSRFStrategy
} from '@angular/http';
-declare var window: any;
-
+import { IS_DEV_MODE } from './session';
// TODO: Chnage this to use Covalent Http helper service
// https://www.npmjs.com/package/@covalent/http
@@ -31,12 +30,10 @@
@Injectable()
export class ApiXHRBackend extends XHRBackend {
- localhostEnv : boolean = false;
static DEV_TOMCAT_URL : String = 'http://localhost:8080/securis/';
constructor(_browserXHR: BrowserXhr, _baseResponseOptions: ResponseOptions, _xsrfStrategy: XSRFStrategy, private store: Locker) {
super(_browserXHR, _baseResponseOptions, _xsrfStrategy);
- this.localhostEnv = window.location.href.startsWith("http://localhost");
}
createConnection(request: Request): XHRConnection {
@@ -44,7 +41,7 @@
if (token) {
request.headers.set('X-SECURIS-TOKEN', token);
}
- if (this.localhostEnv && !request.url.endsWith('.js') && !request.url.endsWith('.json') && !request.url.endsWith('.html') && !request.url.endsWith('.svg')){
+ if (IS_DEV_MODE && !request.url.endsWith('.js') && !request.url.endsWith('.json') && !request.url.endsWith('.html') && !request.url.endsWith('.svg')){
request.url = ApiXHRBackend.DEV_TOMCAT_URL + request.url; // prefix base url
}
return super.createConnection(request);
--
Gitblit v1.3.2