import { routerRedux } from 'dva/router';
import * as packageProductService from '../../services/WH/packageProduct';

export default {

  namespace: 'WHPackageProduct',
  state: {
  },

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

    },
  },

  effects: {
    *packageProductBySaleOrder ({ payload,onComplete }, { call, put }) {
      const ret = yield call(packageProductService.packageProductBySaleOrder, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
    *cancelPackageProductBySaleOrder ({ payload,onComplete }, { call, put }) {
      const ret = yield call(packageProductService.cancelPackageProductBySaleOrder, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
    *printBoxBySaleOrder ({ payload,onComplete }, { call, put }) {
      const ret = yield call(packageProductService.printBoxBySaleOrder, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
  },

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

};
