{"size": 918, "ext": "js", "max_stars_repo_path": "app/assets/javascripts/stores/comments.factory.js", "max_stars_repo_name": "ms94ap/all-stores", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/assets/javascripts/stores/comments.factory.js", "max_issues_repo_name": "ms94ap/all-stores", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/assets/javascripts/stores/comments.factory.js", "max_forks_repo_name": "ms94ap/all-stores", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 17.0, "max_line_length": 48, "alphanum_fraction": 0.5882352941}
(function() {
	'use strict'

	function CommentFactory($http){
		return {
			createComment: createComment,
			deleteComment: deleteComment
			
		}	

		function createComment(comment) {
			var req = {
				method: 'POST',
				url: '/comments',
				headers: {
	          			'Content-Type': 'application/json'
	       		},
				data: {
					comment: comment
				}
			};
			return $http(req)
				.catch(handleError);	
		}

		function deleteComment(commentId){
			var req = {
				method: 'DELETE',
				url: '/comments/' + commentId,
				headers: {
					'Content-Type': 'application/json'
				},
				
			};
				return $http(req)
    				.then(handleResponse)
    				.catch(handleError);
		}


		function handleResponse(response){
			// console.log(response)
			return response.data
		}

		function handleError(error) {
			console.log(error)
		}
	}
	
	angular
		.module('app')
		.factory('CommentFactory', CommentFactory)
}());