Deploy the assets
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
Deploy the sample react app
- Download the sample react app
- Unzip the contents of the react app in a new folder
- Navigate to the folder and run the following commands
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.
recommendation-more-help
8de24117-1378-413c-a581-01e660b7163e