Deploy the assets

The following assets/configurations were deployed on a AEM Forms publish server.

Deploy the sample react app

npm install
npm start

Open the EmergencyContact.js file and change the URL in the fetch method to match your environment.

 const getWebForm=async()=>
     {
        setSpinner(true)
        console.log("inside widgetURL function emergency contact");
        // NOTE: replace the `aemforms.azure.com:4503` with your AEM FORM server
        let res = await fetch("http://aemforms.azure.com:4503/bin/getwidgeturl",
          {
            method: "POST",
            body: JSON.stringify({"icTemplate":"/content/forms/af/waiver/waiver/channels/print","waiver":formData})

         })

To enable making POST calls to the AEM endpoint from your REACT app, you will need to specify the appropriate entires in the Allowed Origins field in Adobe Granite Cross-Origin Resource Sharing Policy configuration.

cors-setting

See understanding CORS with AEM for more details on CORS configuration options.

recommendation-more-help
8de24117-1378-413c-a581-01e660b7163e