Adding the rest back in.
Some checks failed
Auto Maintenance Cycle / pre-commit Autoupdate (push) Failing after 34s

This commit is contained in:
2023-11-19 03:47:39 +01:00
parent 6e037d6837
commit ff32b18cc4
223 changed files with 34973 additions and 0 deletions

View File

@ -0,0 +1,21 @@
'use strict'
const RedirectHandler = require('../handler/RedirectHandler')
function createRedirectInterceptor ({ maxRedirections: defaultMaxRedirections }) {
return (dispatch) => {
return function Intercept (opts, handler) {
const { maxRedirections = defaultMaxRedirections } = opts
if (!maxRedirections) {
return dispatch(opts, handler)
}
const redirectHandler = new RedirectHandler(dispatch, maxRedirections, opts, handler)
opts = { ...opts, maxRedirections: 0 } // Stop sub dispatcher from also redirecting.
return dispatch(opts, redirectHandler)
}
}
}
module.exports = createRedirectInterceptor