The following assets/configurations were deployed on a AEM Forms publish server.
Add the following entry in the Apache Sling Service User Mapper Service using the OSGi configMgr
DevelopingWithServiceUser.core:getformsresourceresolver=fd-service
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.
See understanding CORS with AEM for more details on CORS configuration options.