Advertisement
Guest User

Untitled

a guest
Aug 1st, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. export const GeneralEnquiryForm = compose(
  2.   mapProps(props => Object.assign({}, props, props.conf, { mapDataToSubmit, mapDataToSubscribe })),
  3.   withRemoteSubmit(props => props.endpoint ? props.endpoint : '//data.fclmedia.com/sendEnquiry', 'GET', 'submitEnquiry'),
  4.   withRemoteSubmit(props => props.subscribeEndpoint ? props.subscribeEndpoint : '/api/external_endpoint/salesforce_subscribe', 'GET', 'subscribe'),
  5.   withFlatModel(enquiryModel, modelTransforms),
  6.   withEventListener('react-form-update.form.enquiry.general', (data, props) => {
  7.     Object.keys(data).map(key => {
  8.       let newValue = data[key];
  9.       // We cannot directly map return date or depart date because it
  10.       // may come through in an alternate format.
  11.       if (key === 'returnDate' || key === 'departDate') {
  12.         newValue = checkDate(newValue, today);
  13.       }
  14.       props.updateModelField(key, newValue);
  15.     });
  16.   }),
  17.   withEventListener('SELECTED_TILE', (data, props) => {
  18.     Object.keys(data).map(key => {
  19.       let newValue = data[key];
  20.       props.updateModelField(key, newValue);
  21.     });
  22.   })
  23. )(BaseEnquiryForm);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement