Refactor entry state toggle (#48)
* chore(editorialFeatures): extract editorial features toggle * chore(refactor): rename function to make more contextual sense
This commit is contained in:
committed by
Benedikt Rötsch
parent
fc68385384
commit
ae599ccdfe
@@ -5,7 +5,8 @@
|
||||
const url = require('url')
|
||||
|
||||
const { getLandingPage } = require('../services/contentful')
|
||||
const attachEntryState = require('./../lib/entry-state')
|
||||
const attachEntryState = require('../lib/entry-state')
|
||||
const shouldAttachEntryState = require('../lib/should-attach-entry-state')
|
||||
|
||||
/**
|
||||
* Renders a landing page when `/` route is requested
|
||||
@@ -27,7 +28,7 @@ module.exports.getLandingPage = async (request, response, next) => {
|
||||
)
|
||||
|
||||
// Attach entry state flags when using preview API
|
||||
if (response.locals.settings.editorialFeatures && response.locals.currentApi.id === 'cpa') {
|
||||
if (shouldAttachEntryState(response)) {
|
||||
landingPage = await attachEntryState(landingPage)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user