2FAuth/resources/js/router/middlewarePipeline.js
2023-12-01 15:29:26 +01:00

12 lines
352 B
JavaScript
Vendored

export default function middlewarePipeline(context, middlewares, index) {
const nextMiddleware = middlewares[index];
if (!nextMiddleware) {
return context.next;
}
return () => {
nextMiddleware({
...context,
nextMiddleware: middlewarePipeline(context, middlewares, index + 1),
});
};
}