import Vue from 'vue';
import Vuex from 'vuex';
import _ from 'lodash';
Vue.use(Vuex);
const api = {
  list: `/api/cms/column/list`,
  fetch: id => `/api/cms/column/fetch/${id}`,
};
export const state = () => ({});
export const mutations = {};
export const actions = {
  async getColumn({ commit }, { type, data }) {
    let result;
    if (type === `list`) {
      result = await this.$axios.$get(api.list, data);
    } else {
      let { id } = data;
      result = await this.$axios.$get(api.fetch(id));
    }

    return result;
  },
};
