fix: no more duplicate error messges (#71)

* fix: Fix middlware order

* fix: Remove console.log

* feat: Uniq error meassages
This commit is contained in:
Khaled Garbaya
2017-11-15 16:36:23 +01:00
committed by GitHub
parent c054f82a08
commit 14ce69ff19
2 changed files with 4 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ const { createClient } = require('contentful')
const { initClients, getSpace } = require('./../services/contentful')
const { updateCookie } = require('../lib/cookies')
const { translate } = require('../i18n/i18n')
const { uniqWith, isEqual } = require('lodash')
const SETTINGS_NAME = 'theExampleAppSettings'
async function renderSettings (response, opts) {
@@ -58,7 +58,7 @@ module.exports.getSettings = async (request, response, next) => {
*/
module.exports.postSettings = async (request, response, next) => {
const currentLocale = response.locals.currentLocale
const errorList = []
let errorList = []
const { spaceId, deliveryToken, previewToken, editorialFeatures } = request.body
const settings = {
spaceId,
@@ -143,7 +143,7 @@ module.exports.postSettings = async (request, response, next) => {
}
}
}
errorList = uniqWith(errorList, isEqual)
// If no errors, then cache the new settings in the cookie
if (!errorList.length) {
// Store new settings