import * as api from './service';

const tableDate = [{}];

const Model = {
  namespace: 'pendingDeliveryOrder',
  state: {
    tableData: [],
    typeList: [],
    organizationList: [],
  },
  effects: {
    *getSubjectList({ payload }, { call, put }) {
      yield put({
        type: 'saveData',
        payload: {
          tableData: tableDate,
        },
      });
      // const response = yield call(api.subjectList, payload);
      // if (response.code === 2000) {
      //   yield put({
      //     type: 'saveData',
      //     payload: {
      //       tableData: response.data,
      //     },
      //   });
      // }
    },
    *subjectTypeList({ payload }, { call, put }) {
      // const response = yield call(api.subjectTypeList, payload);
      // if (response.code === 2000) {
      //   yield put({
      //     type: 'saveData',
      //     payload: {
      //       typeList: response.data,
      //     },
      //   });
      // }
    },
    *organizationList({ payload }, { call, put }) {
      // const response = yield call(api.organizationList, payload);
      // if (response.code === 2000) {
      //   yield put({
      //     type: 'saveData',
      //     payload: {
      //       organizationList: response.data,
      //     },
      //   });
      // }
    },
  },
  reducers: {
    saveData(state, action) {
      const data = action.payload;
      return { ...state, ...data };
    },
  },
};
export default Model;
