• Sagar Manglani 14
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
I am trying to create a web to lead form in React.js but it is giving me following error
Error screenshotI have included domains in Whitelisted Origins and remote sites list
The react code I am using on submitting is - 
handleSubmit = async (e) => {
  const { general_settings } = this.props;
  e.preventDefault();
  if (!this.state.submitDisabled) {
    const validation = await this.formRef.current.validate();
    if (typeof validation.errors === 'undefined') {
      const {value} = validation;

      this.setState({processing: true});

      const formValues = {
        oid: general_settings.salesforce_oid,
        recordType: general_settings.salesforce_record_type,
        Campaign_ID: this.props.campaign_id,
        lead_source: "JH Website",
        ...value
      };

      this.Axios = axios.create();

      const results = await this.Axios.post(general_settings.salesforce_url, formValues);
      this.setState({processing: false, submitted: true});
    } else {
      this.setState({errors: validation.errors});
    }
  }
};