Skip to content

Commit

Permalink
feat: submit form with formsupport
Browse files Browse the repository at this point in the history
  • Loading branch information
nzambello committed Mar 12, 2021
1 parent 959f1d0 commit b27b736
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/actions/index.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/**
* emailNotification actions.
* @module actions/emailNotification/emailNotification
* submitForm actions.
* @module actions/submitForm
*/

export const EMAIL_SEND_ACTION_FORM = 'EMAIL_SEND_ACTION_FORM';
export const SUBMIT_FORM_ACTION = 'SUBMIT_FORM_ACTION';

/**
* Email send function
* @function sendActionForm
* submitForm function
* @function submitForm
* @param {string} pat
* @param {string} block_id
* @param {Object} data
* @returns {Object} attachments
*/
export function sendActionForm(path = '', block_id, data, attachments) {
export function submitForm(path = '', block_id, data, attachments) {
return {
type: EMAIL_SEND_ACTION_FORM,
type: SUBMIT_FORM_ACTION,
request: {
op: 'post',
path: path + '/@send-action-form',
path: path + '/@submit-form',
data: {
block_id,
data,
Expand Down
4 changes: 2 additions & 2 deletions src/components/Form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect, useReducer } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import PropTypes from 'prop-types';
import { useIntl, defineMessages } from 'react-intl';
import { sendActionForm } from '../actions';
import { submitForm } from '../actions';
import { getFieldName } from './utils';
import FormView from './FormView';

Expand Down Expand Up @@ -107,7 +107,7 @@ const Form = ({ data, id, path }) => {
});

dispatch(
sendActionForm(
submitForm(
path,
id,
Object.keys(formData).map((name) => ({
Expand Down

0 comments on commit b27b736

Please sign in to comment.