Commit 5ef3ec06c37f9398c65534721b85fb666cbb6714

Authored by ABNER SILVA DE OLIVEIRA
1 parent 12120fb1
Exists in master and in 1 other branch dev-fixes

fixed post to noosfero api

src/lib/ng-noosfero-api/http/restangular_service.ts
... ... @@ -125,7 +125,7 @@ export abstract class RestangularService<T extends noosfero.RestModel> {
125 125  
126 126 return deferred.promise;
127 127 }
128   -
  128 +
129 129 /**
130 130 * Do a HTTP GET call to the resource collection represented
131 131 *
... ... @@ -226,10 +226,13 @@ export abstract class RestangularService<T extends noosfero.RestModel> {
226 226  
227 227 let restRequest: ng.IPromise<noosfero.RestResult<T>>;
228 228  
  229 + let data = <any>{ };
  230 + data[this.getDataKeys().singular] = obj;
  231 +
229 232 if (rootElement) {
230   - restRequest = rootElement.all(this.getResourcePath()).post(obj, queryParams, headers);
  233 + restRequest = rootElement.all(this.getResourcePath()).post(data, queryParams, headers);
231 234 } else {
232   - restRequest = this.baseResource.post(obj, queryParams, headers);
  235 + restRequest = this.baseResource.post(data, queryParams, headers);
233 236 }
234 237  
235 238 restRequest.then(this.getHandleSuccessFunction(deferred))
... ...