import { routerRedux } from 'dva/router';
import * as emOrderService from '../../services/EM/emOrder';

export default {

  namespace: 'EMemOrder',
  state: {

  },

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

    },
  },

  effects: {
    *getEmOrder ({ payload,onComplete }, { call, put }) {
      const ret = yield call(emOrderService.getEmOrder, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },*getBtnList({ payload,onComplete }, { call, put }) {
      const ret = yield call(emOrderService.getBtnList, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },*fullUpdate({ payload,onComplete }, { call, put }) {
      const ret = yield call(emOrderService.fullUpdate, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },*cancelEmOrder({ payload,onComplete }, { call, put }) {
      const ret = yield call(emOrderService.cancelEmOrder, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },*confirmEmOrder({ payload,onComplete }, { call, put }) {
      const ret = yield call(emOrderService.confirmEmOrder, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
    *getFlowCardPrint({ payload,onComplete }, { call, put }) {
      const ret = yield call(emOrderService.getFlowCardPrint, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
    *updatePrintStatus({ payload,onComplete }, { call, put }) {
      const ret = yield call(emOrderService.updatePrintStatus, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
  },

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

};
