import { routerRedux } from 'dva/router';
import * as WorkStageCalendarService from '../../services/FM/workStageCalendar';

export default {

  namespace: 'FMWorkStageCalendar',
  state: {
  },

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

    },
  },

  effects: {
    *batchUpdate ({ payload,onComplete }, { call, put }) {
      const ret = yield call(WorkStageCalendarService.upDate, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
    *allUpdate ({ payload,onComplete }, { call, put }) {
      const ret = yield call(WorkStageCalendarService.allUpdate, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
  },

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

};
