Skip to content
This repository was archived by the owner on May 28, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/api/extensions/cms-data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,37 @@ module.exports = ({ config, db }) => {
})
})

cmsApi.get('/cmsPageIdentifier/:identifier/storeId/:storeId', (req, res) => {
const client = Magento2Client(config.magento2.api);
client.addMethods('cmsPageIdentifier', function (restClient) {
let module = {};
module.getPageIdentifier = function () {
return restClient.get(`/snowdog/cmsPageIdentifier/${req.params.identifier}/storeId/${req.params.storeId}`);
}
return module;
})
client.cmsPageIdentifier.getPageIdentifier().then((result) => {
apiStatus(res, result, 200); // just dump it to the browser, result = JSON object
}).catch(err => {
apiStatus(res, err, 500);
})
})

cmsApi.get('/cmsBlockIdentifier/:identifier/storeId/:storeId', (req, res) => {
const client = Magento2Client(config.magento2.api);
client.addMethods('cmsBlockIdentifier', function (restClient) {
let module = {};
module.getBlockIdentifier = function () {
return restClient.get(`/snowdog/cmsBlockIdentifier/${req.params.identifier}/storeId/${req.params.storeId}`);
}
return module;
})
client.cmsBlockIdentifier.getBlockIdentifier().then((result) => {
apiStatus(res, result, 200); // just dump it to the browser, result = JSON object
}).catch(err => {
apiStatus(res, err, 500);
})
})

return cmsApi
}