<commit_before>angular.module('cleaverApp', [])

// this factory handles requests between the client and server

.factory('Rec', ['$http', function($http) {
  return {
    getRestaurants: function(uniqueID) {
      var promise = $http.get('/api/' + uniqueID)
      .success(function(data, status, config, headers){
        restaurantData = data;
      })
      .error(function(){
        console.error('error getting restaurants');
      });
    },
    
    postLocation: function(data) {
      $http.post('/location', data)
    },
    restaurants: function() { return restaurantData; };
  }
}]);<commit_msg>refactored Rec factory<commit_after>angular.module('cleaverApp', [])

// this factory handles requests between the client and server

.factory('Rec', ['$http', function($http) {
  var restaurants;

  var getRestaurants = function (uniqueID) {
    return $http({
      method: 'GET',
      url: '/api/' + uniqueID
    })
    .then(function (resp) {
      console.log("get restaurants", resp.data);
      restaurants = resp.data;
    });
  };

  var addLocation = function() {
    return $http({
      method: 'POST',
      url: '/api/location',
      // data: { url:link }
    }).then(function(resp) {
      console.log("added location", resp);
    });
  };

  return {
    getRestaurants: getRestaurants,
    addLocation: addLocation,
    restaurants: restaurants
  };

}]);
{'fraction_non_alphanumeric': 0.1577424023154848, 'fraction_numerical': 0.0, 'mean_word_length': 2.928977272727273, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7454954', 'n_tokens_mistral': 411, 'n_tokens_neox': 414, 'n_words': 95}