From 1a0491f2462d2c309bd8e310b22c11019a79ce1e Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Mon, 20 Mar 2017 16:02:14 +0000
Subject: [PATCH] #3527 fix - Added applications forms and metadata component

---
 securis/src/main/webapp/src/app/resources/base.ts |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/securis/src/main/webapp/src/app/resources/base.ts b/securis/src/main/webapp/src/app/resources/base.ts
index 4f79cc2..c03ed59 100644
--- a/securis/src/main/webapp/src/app/resources/base.ts
+++ b/securis/src/main/webapp/src/app/resources/base.ts
@@ -1,3 +1,5 @@
+import { LocaleService } from '../common/i18n';
+import { BasicService } from '../common/utils';
 import { Observable } from 'rxjs/Observable';
 import { Http, RequestOptionsArgs, URLSearchParams } from '@angular/http';
 
@@ -8,29 +10,31 @@
   }
 }
 
-export class SeCurisResourceServices {
-    constructor(protected http: Http,
+export class SeCurisResourceServices extends BasicService {
+    constructor($L: LocaleService,
+                protected http: Http,                
                 protected resource: string) {
+        super($L);
     }    
 
     public get(id?: any) : Observable<any> {
       let url = `${this.resource}/${id || ''}`;
-      return this.http.get(url).map(response => response.json());
+      return this.http.get(url).map(response => response.json()).catch(err => super.processErrorResponse(err));
     }
 
     public create(data: any) : Observable<any> {
       let url = `${this.resource}`;
-      return this.http.post(url, JSON.stringify(data)).map(response => response.json());
+      return this.http.post(url, JSON.stringify(data)).map(response => response.json()).catch(err => super.processErrorResponse(err));
     }
 
     public modify(id: any, data: any) : Observable<any> {
       let url = `${this.resource}/${id}`;
-      return this.http.post(url, JSON.stringify(data)).map(response => response.json());
+      return this.http.post(url, JSON.stringify(data)).map(response => response.json()).catch(err => super.processErrorResponse(err));
     }
 
     public remove(id: any) : Observable<any> {
       let url = `${this.resource}/${id}`;
-      return this.http.delete(url).map(response => response.json());
+      return this.http.delete(url).map(response => response.json()).catch(err => super.processErrorResponse(err));
     }
     
     public action(id: any, action: string, method = 'POST') : Observable<any> {
@@ -44,6 +48,8 @@
         search: (method == 'GET') && new MySearchParams(params) || undefined,
         body: (method == 'POST') && JSON.stringify(params) || undefined
       };
-      return this.http.request(url, options).map(response => response.json());
+      return this.http.request(url, options).map(response => response.json()).catch(err => super.processErrorResponse(err));
     }
+
+
 }
\ No newline at end of file

--
Gitblit v1.3.2