import { routerRedux } from 'dva/router';
import * as orderService from '../../services/SO/order';

export default {

  namespace: 'SOOrder',
  state: {
  },

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

    },
  },

  effects: {
    *confirm ({ payload,onComplete }, { call, put }) {
      const ret = yield call(orderService.confirm, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
    *confirmMrpComplete ({ payload,onComplete }, { call, put }) {
      const ret = yield call(orderService.confirmMrpComplete, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
  },

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

};
