diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/controller/ShareController.js | 7 | ||||
-rw-r--r-- | js/service/ShareResource.js | 10 |
2 files changed, 17 insertions, 0 deletions
diff --git a/js/controller/ShareController.js b/js/controller/ShareController.js index 4b7f15d0e..2977dc2c2 100644 --- a/js/controller/ShareController.js +++ b/js/controller/ShareController.js @@ -25,4 +25,11 @@ app.controller('ShareController', function (ShareResource) { }); }; + this.shareItem = function(itemId, userId) { + var response = ShareResource.shareItem(itemId, userId); + response.then((result) => { + return result; + }); + }; + });
\ No newline at end of file diff --git a/js/service/ShareResource.js b/js/service/ShareResource.js index d497c18f7..4ccf90e11 100644 --- a/js/service/ShareResource.js +++ b/js/service/ShareResource.js @@ -22,6 +22,16 @@ app.factory('ShareResource', function (Resource, $http, BASE_URL) { }); }; + ShareResource.prototype.shareItem = function (itemId, userId) { + var url = this.BASE_URL + + '/items/' + itemId + '/share/' + userId; + + return this.http({ + url: url, + method: 'POST', + }); + }; + return new ShareResource($http, BASE_URL); });
\ No newline at end of file |