Skip to content
This repository has been archived by the owner on May 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #74 from anqaka/1426
Browse files Browse the repository at this point in the history
1426 - cms integration by identifier
  • Loading branch information
pkarw authored Jul 31, 2018
2 parents f0cd95f + 7f7ed7c commit 570873a
Showing 1 changed file with 32 additions and 0 deletions.
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
}

0 comments on commit 570873a

Please sign in to comment.