reduxform.js 651 Bytes
import { take, select, call, takeEvery, put } from 'redux-saga/effects';
import { change, submit, initialize } from 'redux-form';
import * as types from '../actionTypes';
import api from '../../utils/api';
import { dispatch } from '../../utils/commonUtils';


/*
 * 表单初始化后自动加载load
 */
function* initLoadSearchForm(action) {
    while (true) {
        const searchAction = yield take('@@redux-form/INITIALIZE');
        const { meta = {}, payload = {} } = searchAction;
        if (payload.auto_load) {
            const { form } = meta;
            dispatch(submit(form));
        }
    }
}

export default [initLoadSearchForm()];