ContentService is used to get the data of the base theme configured in Admin Panel. You can import the ContentService from the experro-storefront package.
ContentService provides.
getSingleTypeContentgetCollectionRecordsByCollectionInternalNamegetCollectionTypeContentByIdgetMenuByIdgetContentModelRecordsByFieldKeyValue
getSingleTypeContent
This function returns the single type data. This function accepts an object withmodelName as the property.
getCollectionRecordsByCollectionInternalName
This function returns the record list byid, versionId, modelName, and componentId.
getCollectionTypeContentById
This function returns the collection type by content id. This function accepts an object with the properies you get fromgetCollectionRecordsByCollectionInternalName function call.
id in ssrKey should be any unique value for each API call. If same duplicate id is found, it may behave differently.
getMenuById
This function returns menu or navigation created in Admin Panel. This function acceptmenuId.
getContentModelRecordsByFieldKeyValue
This function returns all the records by the model internal name. If you’ve created the “zig zag banner”, with this method, you’ll get all the records for this “zig zag banner” as an array of objects contains data for the “zig zag banner”.fieldsToQuery e.g.,
| Property | Description | Type |
|---|---|---|
sortBy | Field to sort by. | String |
sortType | The direction to sort ascending or descending as ASC or DESC. | String |
limit | Number of records you want to fetch. | Number |
skip | Number of records you want to skip. | Number |
Note: The following properties need to be used together:
sortBy and sortType
limit and skip