@hmcts/one-per-page
Advanced tools
Comparing version 4.0.6 to 4.0.7
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://github.com/hmcts/one-per-page#readme", | ||
"version": "4.0.6", | ||
"version": "4.0.7", | ||
"main": "./src/main.js", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -22,3 +22,7 @@ const { notDefined } = require('../util/checks'); | ||
} | ||
this.nextFlow.redirect(req, res); | ||
if (typeof this.nextFlow === 'function') { | ||
this.nextFlow(req, res, next); | ||
} else { | ||
this.nextFlow.redirect(req, res, next); | ||
} | ||
}) | ||
@@ -28,3 +32,3 @@ .catch(error => { | ||
const errorMsg = `No error flow chained to action from ${req.path}`; | ||
log.error(errorMsg); | ||
log.warn(errorMsg); | ||
next(error); | ||
@@ -34,3 +38,8 @@ return; | ||
log.error(error); | ||
this.errorFlow.redirect(req, res); | ||
if (typeof this.errorFlow === 'function') { | ||
this.errorFlow(error, req, res, next); | ||
} else { | ||
this.errorFlow.redirect(req, res, next); | ||
} | ||
}); | ||
@@ -37,0 +46,0 @@ } |
@@ -10,5 +10,5 @@ const Redirect = require('./Redirect'); | ||
handler(req, res) { | ||
handler(req, res, next) { | ||
req.session.entryPoint = this.name; | ||
super.handler(req, res); | ||
super.handler(req, res, next); | ||
} | ||
@@ -15,0 +15,0 @@ |
@@ -12,5 +12,5 @@ const BaseStep = require('./BaseStep'); | ||
handler(req, res) { | ||
handler(req, res, next) { | ||
if (req.method === 'GET') { | ||
this.next().redirect(req, res); | ||
this.next().redirect(req, res, next); | ||
} else { | ||
@@ -17,0 +17,0 @@ res.sendStatus(METHOD_NOT_ALLOWED); |
1345539
8984