Next.js website for Rocky Mountain Vending company featuring: - Product catalog with Stripe integration - Service areas and parts pages - Admin dashboard with Clerk authentication - SEO optimized pages with JSON-LD structured data Co-authored-by: Cursor <cursoragent@cursor.com>
21 lines
660 B
Text
21 lines
660 B
Text
'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
|