import Vue from 'vue';
import Vuex from 'vuex';
import _ from 'lodash';
Vue.use(Vuex);
const api = {
  list: `/api/jobs/infos`,
  fetch: id => `/api/jobs/infos/${id}`,
};
export const state = () => ({});
export const mutations = {};
export const actions = {
  //在线招聘
  async getJobInfo({ state }, { type, data }) {
    let { skip = 0, limit } = data;
    let result;
    if (type === 'list') {
      let { schid, is_practice, ...searchInfo } = data;
      result = await this.$axios.$get(
        api.list,
        {},
        {
          schid: schid,
          is_practice: is_practice,
          skip: skip,
          limit: limit,
          status: 1,
          ...searchInfo,
        }
      );
    }
    if (type === 'search') {
      let { id } = data;
      result = await this.$axios.$get(api.fetch(id));
    }
    return result;
  },
};
