Feature(server): Add response type detecting to lang redirect

This commit is contained in:
Berkeley Martinez
2016-07-16 10:40:14 -07:00
parent 0d3dd75f41
commit 5d94cb369d
2 changed files with 19 additions and 6 deletions

View File

@@ -19,10 +19,10 @@ export default function prodErrorHandler() {
}
// parse res type
var accept = accepts(req);
var type = accept.type('html', 'json', 'text');
const accept = accepts(req);
const type = accept.type('html', 'json', 'text');
var message = 'Oops! Something went wrong. Please try again later';
const message = 'Oops! Something went wrong. Please try again later';
if (type === 'html') {
if (typeof req.flash === 'function') {
req.flash(err.messageType || 'errors', {