feat(editors): add editorial features aka the configurable edit link

This commit is contained in:
Benedikt Rötsch
2017-10-18 16:35:53 +02:00
committed by Benedikt Rötsch
parent bf50c66df4
commit 240e008a87
8 changed files with 97 additions and 47 deletions

View File

@@ -25,13 +25,7 @@ async function renderSettings (res, opts) {
/* GET settings page. */
router.get('/', catchErrors(async function (req, res, next) {
const cookie = req.cookies.theExampleAppSettings
const settings = cookie || {
space: process.env.CF_SPACE,
cda: process.env.CF_ACCESS_TOKEN,
cpa: process.env.CF_PREVIEW_ACCESS_TOKEN
}
const { settings } = res.locals
await renderSettings(res, {
settings
})
@@ -40,8 +34,13 @@ router.get('/', catchErrors(async function (req, res, next) {
/* POST settings page. */
router.post('/', catchErrors(async function (req, res, next) {
const errorList = []
const { space, cda, cpa } = req.body
const settings = {space, cda, cpa}
const { space, cda, cpa, editorialFeatures } = req.body
const settings = {
space,
cda,
cpa,
editorialFeatures: !!editorialFeatures
}
// Validate required fields.
if (!space) {