import { query } from '@/services/user';
import { getExamInfo } from '@/pages/edit/service';
const ReportModel = {
  namespace: 'report',
  state: {
    taskName: '',
    collaborative_type:''
  },
  effects: {
    * getTaskName({ payload }, { call, put}){
      const { examId } = payload;
      const res = yield call(getExamInfo, examId);
      const taskName = res?.result?.name;
      const collaborative_type = res?.result?.collaborative_type;
      yield put({
        type: 'saveTaskName',
        payload: { taskName,collaborative_type },
      });
    },
  },
  reducers: {
    saveTaskName(state, { payload }) {
      const {collaborative_type,taskName} = payload;
      return { ...state, taskName ,collaborative_type };
    },
  }
};
export default ReportModel;
