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

    return result;
  },
};
