{"size": 1118, "ext": "js", "max_stars_repo_path": "frontend/src/store/main/actions.js", "max_stars_repo_name": "frias0/lunch-menu", "max_stars_repo_stars_event_min_datetime": "2020-01-27T11:39:04.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-21T12:00:21.000Z", "max_issues_repo_path": "frontend/src/store/main/actions.js", "max_issues_repo_name": "frias0/lunch-menu", "max_issues_repo_issues_event_min_datetime": "2020-02-11T12:52:05.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T11:26:10.000Z", "max_forks_repo_path": "frontend/src/store/main/actions.js", "max_forks_repo_name": "frias0/lunch-menu", "max_forks_repo_forks_event_min_datetime": "2020-01-27T12:34:21.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-09T09:50:12.000Z"}
{"max_stars_count": 7, "max_issues_count": 12, "max_forks_count": 4, "avg_line_length": 23.7872340426, "max_line_length": 65, "alphanum_fraction": 0.5983899821}
import axios from 'axios';

export function getRestaurants ({ commit }) {
  return new Promise((resolve, reject) => {
    axios
      .get('/api/restaurant')
      .then((response) => {
        commit('updateRestaurants', response.data.restaurants);
        commit('updateVisRes', response.data.restaurants);
        resolve(response);
      })
      .catch((err) => {
        reject(err);        
      });
  });
}

export function getRestaurant ({ commit }, identifier) {
  return new Promise((resolve, reject) => {
    axios
      .get('/api/restaurant/' + identifier)
      .then((response) => {
        resolve(response);
      })
      .catch((err) => {
        reject(err);        
      });
  });
}

export function setRegion ({ commit }, value) {
  commit('updateRegion', value);
}

export function setShowMapList ({ commit }, value) {
  commit('updateShowMapList', value);
}

// expects payload to be {'restaurant': name, 'favourite': state}
export function setFavourite ({ commit }, payload) {
  commit('updateFavourite', payload);
}

export function updateVisRes ({ commit }) {
  commit('updateVisRes');
}
