0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Simplified controller checks in {{get}} helper

This commit is contained in:
Nazar Gargol 2019-09-12 17:48:29 +02:00
parent 185d2145ee
commit 527dba8839

View file

@ -140,14 +140,14 @@ get = function get(resource, options) {
return Promise.resolve(options.inverse(self, {data: data}));
}
const controller = api[apiVersion][RESOURCES[resource].alias] ? RESOURCES[resource].alias : RESOURCES[resource].resource;
const controller = api[apiVersion][RESOURCES[resource].alias];
const action = isBrowse(apiOptions) ? 'browse' : 'read';
// Parse the options we're going to pass to the API
apiOptions = parseOptions(ghostGlobals, this, apiOptions);
// @TODO: https://github.com/TryGhost/Ghost/issues/10548
return api[apiVersion][controller][action](apiOptions).then(function success(result) {
return controller[action](apiOptions).then(function success(result) {
var blockParams;
// used for logging details of slow requests