import { routerRedux } from 'dva/router';
import * as orderPermitService from '../../services/PO/orderPermit';

export default {

  namespace: 'POOrderPermitShow',
  state: {
  },

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

    },
  },

  effects: {
    *getOrder ({ payload,onComplete }, { call, put }) {
      const ret = yield call(orderPermitService.getOrder, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
    *getBtnList({ payload,onComplete }, { call, put }) {
      const ret = yield call(orderPermitService.getBtnList, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
    *sendFlow({ payload,onComplete }, { call, put }) {
      const ret = yield call(orderPermitService.sendFlow, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
  },

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

};
