import Vue from 'vue';
import Vuex from 'vuex';
import _ from 'lodash';
Vue.use(Vuex);
const api = {
  claimInfo: `/api/financial/claimneed`,
};
const state = () => ({});
const mutations = {};

const actions = {
  async fetch({ commit }, payload) {
    const res = await this.$axios.$get(`${api.claimInfo}/${payload}`);
    return res;
  },
  async update({ commit }, { id, ...data }) {
    const res = await this.$axios.$post(`${api.claimInfo}/update/${id}`, data);
    return res;
  },
  async followclaim({ commit }, payload) {// 金融机构关注债权需求
    const res = await this.$axios.$post(`${api.claimInfo}/followclaim`, payload);
    return res;
  },
  async fclaim({ commit }, payload) {// 根据金融机构查询债权需求(列表)--分为指向（传金融机构ID）和非指向（不用传）
    const res = await this.$axios.$post(`${api.claimInfo}/fclaim`,payload);
    return res;
  },
  async one({ commit }, payload) {// 详情
    const res = await this.$axios.$post(`${api.claimInfo}/one`,payload);
    return res;
  },
  async beforFollow({ commit }, payload) {// 关注前请求的接口
    const res = await this.$axios.$post(`${api.claimInfo}/beforFollow`,payload);
    return res;
  }

};
export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
