import axios from 'axios';

export default {
  namespaced: true,
  state: {
    properties: [],
  },
  mutations: {
    setProperties(state, properties) {
      state.properties = properties;
    },
  },
  getters: {},
  actions: {
    getProperties({ commit }, item) {
      axios
        .get(`/api/property/${item.propertyType}/${item.user}`)
        .then(result => commit('setProperties', result.data))
        .catch(console.error);
    },
  },
};
