
import * as feedProposalService from '../../services/EM/feedProposal';

export default {

  namespace: 'EMFeedProposal',
  state: {
  },

  subscriptions: {
    setup({ dispatch, history }) {  // eslint-disable-line

    },
  },

  effects: {
    *getMrpData ({ payload,onComplete }, { call, put }) {
      const ret = yield call(feedProposalService.getMrpData, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
    *getBtnList({ payload,onComplete }, { call, put }) {
      const ret = yield call(feedProposalService.getBtnList, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
    *saveMrpData({ payload,onComplete }, { call, put }) {
      const ret = yield call(feedProposalService.saveMrpData, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
    *getMrpEmProposals({ payload,onComplete }, { call, put }) {
      const ret = yield call(feedProposalService.getMrpEmProposals, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
  },

  reducers: {
    save(state, action) {
      return { ...state, ...action.payload };
    },
  },

};
