comment.factory.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. (function() {
  2. 'use strict';
  3. app.factory('comment.repository', ['WebApi', '$http', function(WebApi, $http) {
  4. return {
  5. getComments: _getComments,
  6. addComment: _addComment,
  7. deleteComment: _deleteComment,
  8. editComment: _editComment,
  9. deleteSecondComment: _deleteSecondComment,
  10. editSecondComment: _editSecondComment,
  11. commentReply: _commentReply
  12. };
  13. function _getComments(){
  14. return $http.get(WebApi.DOMAIN + '/comments');
  15. };
  16. function _addComment(data){
  17. return $http.post(WebApi.DOMAIN + '/addComment', data);
  18. };
  19. function _deleteComment(id){
  20. return $http.delete(WebApi.DOMAIN + '/deleteComment/' + id);
  21. };
  22. function _editComment(data){
  23. return $http.put(WebApi.DOMAIN + '/editComment/', data);
  24. };
  25. function _deleteSecondComment(mainId, secondId){
  26. return $http.delete(WebApi.DOMAIN + '/deleteSecondComment/' + mainId + '/' + secondId);
  27. };
  28. function _commentReply(data){
  29. return $http.post(WebApi.DOMAIN + '/commentReply', data);
  30. };
  31. function _editSecondComment(data){
  32. return $http.put(WebApi.DOMAIN + '/editSecondComment/', data);
  33. };
  34. }])
  35. })()