Steps to add an API call to an app-module
-
Find the endpoint of the API call, and search the
common/exp-data/src/resources folder for existing Resource files
that hit that endpoint.
- If there's an existing resource file with the endpoint, you will add the API call there.
- If not, you will need to create a new resource file.
- Model this resource file after existing resources. Define the API call according to the swagger specifications.
-
Define a data structure in the resource file for the input & output payload of the API if more than one data type is needed.
- Add an epic reducer in the .ducks file that imports the resource and calls the API.
- Combine the epic into the root epic in the .epics file.
- The API call will now be made whenever the reducer is triggered.