diff --git a/src/lib/ng-noosfero-api/http/person.service.ts b/src/lib/ng-noosfero-api/http/person.service.ts index 04eb024..a9885e6 100644 --- a/src/lib/ng-noosfero-api/http/person.service.ts +++ b/src/lib/ng-noosfero-api/http/person.service.ts @@ -28,4 +28,19 @@ export class PersonService extends RestangularService { p.catch(this.getHandleErrorFunction>(deferred)); return deferred.promise; } + + uploadImage(profile: noosfero.Profile, base64_image_json: any) { + let headers = { 'Content-Type': 'application/json' }; + let deferred = this.$q.defer>(); + // TODO dynamically copy the selected attributes to update + let attributesToUpdate: any = { + person: { image_builder: base64_image_json } + }; + let restRequest: ng.IPromise> = + this.getElement(profile.id).customPOST(attributesToUpdate, null, null, headers); + restRequest.then(this.getHandleSuccessFunction(deferred)) + .catch(this.getHandleErrorFunction(deferred)); + return deferred.promise; + } + } -- libgit2 0.21.2