How to use the redux-form.startSubmit function in redux-form

To help you get started, we’ve selected a few redux-form examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bpetetot / conference-hall / src / sagas / events / events.saga.js View on Github external
function* updateEvent(form, event) {
  try {
    // indicate start submitting form
    yield put(startSubmit(form))
    // update event into database
    yield call(eventCrud.update, event)
    // update event in store
    yield put(eventsData.update(event))
    // set form submitted
    yield put(stopSubmit(form))
  } catch (error) {
    yield put(stopSubmit(form, { _error: error.message }))
    throw error
  }
}
github bpetetot / conference-hall / src / sagas / submission / submission.saga.js View on Github external
function* submitTalkToEvent({ talkId, eventId, data }) {
  const FORM = 'submit-talk'
  const talk = yield select(talksData.get(talkId))
  try {
    // indicate start submitting form
    yield put(startSubmit(FORM))
    // check if it's already submitted
    const alreadySubmitted = yield select(isSubmitted(talkId, eventId))
    // submit talk
    yield call(saveTalkSubmission, talk, eventId, data, alreadySubmitted)
    // set form submitted
    yield put(stopSubmit(FORM))
    yield put({ type: 'SUBMISSION_NEXT_STEP' })
  } catch (error) {
    yield put(stopSubmit(FORM, { _error: error.message }))
    throw error
  }
}
github bpetetot / conference-hall / src / sagas / talk / talk.saga.js View on Github external
function* createOrUpdateTalk(form, talk) {
  try {
    // indicate start submitting form
    yield put(startSubmit(form))
    if (form === 'talk-create') {
      // get user id
      const uid = yield select(getUserId)
      // create talk into database
      const ref = yield call(talkCrud.create, { ...talk, speakers: { [uid]: true } })
      // go to talk page
      yield put(push(`/speaker/talk/${ref.id}`))
      // reset form
      yield put(reset(form))
    } else {
      // update talk into database
      yield call(talkCrud.update, talk)
      // update talk into store
      yield put(talkData.update(talk))
      // go to talk page
      yield put(push(`/speaker/talk/${talk.id}`))
github bpetetot / conference-hall / src / store / drivers / reduxForm.js View on Github external
const asyncSubmit = (name, dispatch, getState) => async (callback, ...args) => {
  dispatch(startSubmit(name))
  const response = await callback(...args)
  if (isSubmitting(name)(getState())) dispatch(stopSubmit(name))
  return response
}
github zhuyst / SkyBlog / client_web / src / action / article / ClassifyAction.js View on Github external
export const updateClassify = classify => dispatch => {
    dispatch(startSubmit(FORM_CLASSIFY));

    const url = CLASSIFY_API_URL + `/${classify.id}`;
    return _put(url,classify)
        .then(result => {
            dispatch(stopSubmit(FORM_CLASSIFY,result.errors));

            if(result.code === 200){
                dispatch(success("更新文章分类成功"));
                dispatch(updateClassifyResponse(result));
                dispatch(setClassifyLoading(false))
            }
            else {
                dispatch(error(result.message));
            }
        })
};
github zhuyst / SkyBlog / client_web / src / action / article / ContentAction.js View on Github external
export const insertComment = comment => (dispatch,getState) => {
    dispatch(startSubmit(FORM_COMMENT));

    const articleId = getState().content.article.id;
    const url = ARTICLE_API_URL + `/${articleId}/comment/`;

    return _post(url,comment)
        .then(result => {
            dispatch(setPreviousComment(initialPreviousComment));
            dispatch(stopSubmit(FORM_COMMENT,result.errors));

            if(result.code === 200){
                dispatch(success("新增评论成功"));
                dispatch(insertCommentResponse(result));

                reloadComments(dispatch,getState);
            }
            else {
github zhuyst / SkyBlog / client_web / src / action / user / UsersAction.js View on Github external
export const updateUserInfo = user => dispatch => {
    const url = USER_API_URL + `/${user.id}`;

    dispatch(startSubmit(FORM_USERINFO));
    return _put(url,user)
        .then(result => {
            dispatch(stopSubmit(FORM_USERINFO,result.errors));

            if(result.code === 200){
                dispatch(setUserInfoModalShow(false));
                dispatch(setLoginUser(result.entity));
                dispatch(success("修改个人信息成功"));
                dispatch(updateUserInfoResponse(result))
            }
            else{
                dispatch(error(result.message));
            }

        });
};
github Automattic / wp-calypso / client / extensions / zoninator / state / data-layer / feeds / index.js View on Github external
export const saveZoneFeed = action => [
	startSubmit( action.form ),
	removeNotice( saveFeedNotice ),
	resetLock( action.siteId, action.zoneId ),
	http(
		{
			method: 'POST',
			path: `/jetpack-blogs/${ action.siteId }/rest-api/`,
			query: {
				body: JSON.stringify( toApi( action.posts ) ),
				json: true,
				path: `/zoninator/v1/zones/${ action.zoneId }/posts&_method=PUT`,
			},
		},
		action
	),
];
github webkom / lego-webapp / app / actions / CompanyActions.js View on Github external
return dispatch => {
    dispatch(startSubmit('company'));
    return dispatch(
      callAPI({
        types: Company.ADD,
        endpoint: '/bdb/',
        method: 'POST',
        body: data,
        schema: companySchema,
        meta: {
          errorMessage: 'Legg til bedrift feilet'
        }
      })
    )
      .then(action => {
        if (!action || !action.payload) return;
        const id = action.payload.result;
        dispatch(stopSubmit('company'));
github Automattic / wp-calypso / client / extensions / wp-job-manager / state / data-layer / settings / index.js View on Github external
export const saveSettings = ( { dispatch }, action ) => {
	const { data, form, siteId } = action;

	dispatch( startSave( form ) );
	dispatch( removeNotice( 'wpjm-settings-save' ) );
	dispatch( http( {
		method: 'POST',
		path: `/jetpack-blogs/${ siteId }/rest-api/`,
		query: {
			body: JSON.stringify( toApi( data ) ),
			json: true,
			path: '/wpjm/v1/settings',
		},
	}, action ) );
};