import { routerRedux } from 'dva/router';
import * as emProposalEditService from '../../services/EM/emProposalEdit';
import * as roleEditService from "../../services/FM/roleEdit";

export default {

  namespace: 'EMemProposalEdit',
  state: {

  },

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

    },
  },

  effects: {
    *getProposal ({ payload,onComplete }, { call, put }) {
      const ret = yield call(emProposalEditService.getProposal, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },*getProposalProcess ({ payload,onComplete }, { call, put }) {
      const ret = yield call(emProposalEditService.getProposalProcess, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },*getBtnList({ payload,onComplete }, { call, put }) {
      const ret = yield call(emProposalEditService.getBtnList, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },*fullUpdate({ payload,onComplete }, { call, put }) {
      const ret = yield call(emProposalEditService.fullUpdate, payload,onComplete);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
    *getProposalList({ payload,onComplete }, { call, put }) {
      const ret = yield call(emProposalEditService.getProposalList, payload,onComplete);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
  
    *getFlowCardPrint({ payload,onComplete }, { call, put }) {
      const ret = yield call(emProposalEditService.getFlowCardPrint, payload,onComplete);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
  },

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

};
