Adjusted vote function on API to work with $http