[CORD-873] CRUD for Core and Service model from Chameleon
Change-Id: I45c533feba6720b82de3681d862773047e7fd6f8
diff --git a/src/app/datasources/rest/model.rest.ts b/src/app/datasources/rest/model.rest.ts
index 12590af..4aa862c 100644
--- a/src/app/datasources/rest/model.rest.ts
+++ b/src/app/datasources/rest/model.rest.ts
@@ -16,7 +16,15 @@
public getResource(url: string): ng.resource.IResourceClass<ng.resource.IResource<any>> {
const resource: angular.resource.IResourceClass<any> = this.$resource(`${this.AppConfig.apiEndpoint}${url}/:id/`, {id: '@id'}, {
- update: { method: 'PUT' }
+ update: { method: 'PUT' },
+ query: {
+ method: 'GET',
+ isArray: true,
+ transformResponse: (res) => {
+ // FIXME chameleon return everything inside "items"
+ return res.items ? res.items : res;
+ }
+ }
});
resource.prototype.$save = function() {