model.ts 711 Bytes
Newer Older
1 2
import { message } from 'antd';
import { fakeSubmitForm } from './service';
陈帅's avatar
陈帅 committed
3 4
import { EffectsCommandMap } from 'dva';
import { AnyAction } from 'redux';
5

陈帅's avatar
陈帅 committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
export interface ModalState {}

export type Effect = (
  action: AnyAction,
  effects: EffectsCommandMap & { select: <T>(func: (state: ModalState) => T) => T }
) => void;

export interface ModelType {
  namespace: string;
  state: ModalState;
  effects: {
    submitAdvancedForm: Effect;
  };
}

const Model: ModelType = {
22 23 24 25 26 27 28 29 30 31 32
  namespace: 'BLOCK_NAME_CAMEL_CASE',

  state: {},

  effects: {
    *submitAdvancedForm({ payload }, { call }) {
      yield call(fakeSubmitForm, payload);
      message.success('提交成功');
    },
  },
};
陈帅's avatar
陈帅 committed
33 34

export default Model;