| securis/src/main/webapp/src/app/common/default.requests.options.ts | patch | view | blame | history | |
| securis/src/main/webapp/src/app/common/session.ts | patch | view | blame | history | |
| securis/src/main/webapp/src/environments/environment.dev.ts | patch | view | blame | history | |
| securis/src/main/webapp/src/environments/environment.prod.ts | patch | view | blame | history | |
| securis/src/main/webapp/src/environments/environment.ts | patch | view | blame | history | |
| securis/src/main/webapp/src/main.ts | patch | view | blame | history |
securis/src/main/webapp/src/app/common/default.requests.options.ts
.. .. @@ -10,8 +10,7 @@ 10 10 XHRConnection, 11 11 XSRFStrategy 12 12 } from '@angular/http'; 13 -declare var window: any;14 -13 +import { IS_DEV_MODE } from './session';15 14 16 15 // TODO: Chnage this to use Covalent Http helper service 17 16 // https://www.npmjs.com/package/@covalent/http .. .. @@ -31,12 +30,10 @@ 31 30 @Injectable() 32 31 export class ApiXHRBackend extends XHRBackend { 33 32 34 - localhostEnv : boolean = false;35 33 static DEV_TOMCAT_URL : String = 'http://localhost:8080/securis/'; 36 34 37 35 constructor(_browserXHR: BrowserXhr, _baseResponseOptions: ResponseOptions, _xsrfStrategy: XSRFStrategy, private store: Locker) { 38 36 super(_browserXHR, _baseResponseOptions, _xsrfStrategy); 39 - this.localhostEnv = window.location.href.startsWith("http://localhost");40 37 } 41 38 42 39 createConnection(request: Request): XHRConnection { .. .. @@ -44,7 +41,7 @@ 44 41 if (token) { 45 42 request.headers.set('X-SECURIS-TOKEN', token); 46 43 } 47 - if (this.localhostEnv && !request.url.endsWith('.js') && !request.url.endsWith('.json') && !request.url.endsWith('.html') && !request.url.endsWith('.svg')){44 + if (IS_DEV_MODE && !request.url.endsWith('.js') && !request.url.endsWith('.json') && !request.url.endsWith('.html') && !request.url.endsWith('.svg')){48 45 request.url = ApiXHRBackend.DEV_TOMCAT_URL + request.url; // prefix base url 49 46 } 50 47 return super.createConnection(request); securis/src/main/webapp/src/app/common/session.ts
.. .. @@ -1,6 +1,9 @@ 1 1 import { Locker } from 'angular-safeguard'; 2 2 import { Injectable } from '@angular/core'; 3 3 4 +declare var window: any;5 +6 +export const IS_DEV_MODE : Boolean = window.location.href.startsWith("http://localhost");4 7 5 8 @Injectable() 6 9 export class SeCurisSession { .. .. @@ -8,7 +11,6 @@ 8 11 sessionData: any = {} 9 12 10 13 constructor(private store: Locker) { 11 -12 14 } 13 15 14 16 public get(key: string): any { securis/src/main/webapp/src/environments/environment.dev.tsdeleted file mode 100644
.. .. @@ -1,3 +0,0 @@ 1 -export const environment = {2 - production: false3 -};securis/src/main/webapp/src/environments/environment.prod.tsdeleted file mode 100644
.. .. @@ -1,3 +0,0 @@ 1 -export const environment = {2 - production: true3 -};securis/src/main/webapp/src/environments/environment.tsdeleted file mode 100644
.. .. @@ -1,3 +0,0 @@ 1 -export const environment = {2 - production: false3 -};securis/src/main/webapp/src/main.ts
.. .. @@ -4,10 +4,12 @@ 4 4 import { AppModule } from './app/app.module'; 5 5 6 6 import { enableProdMode } from '@angular/core'; 7 -import { environment } from './environments/environment';7 +import { IS_DEV_MODE } from './app/common/session';8 8 9 -if (environment.production) {9 +if (IS_DEV_MODE) {10 + console.log('Running in dev mode');11 +} else {10 12 enableProdMode(); 11 13 } 12 -// console.log('This is a test.')14 +13 15 platformBrowserDynamic().bootstrapModule(AppModule);