Fix middlewares

This commit is contained in:
JhumanJ 2023-01-26 12:03:29 +01:00
parent bf64c01646
commit 2b02667f34
1 changed files with 12 additions and 4 deletions

View File

@ -182,11 +182,19 @@ function resolveComponents (components) {
function getMiddleware (components) { function getMiddleware (components) {
const middleware = [...globalMiddleware] const middleware = [...globalMiddleware]
components.filter(c => c.middleware).forEach(component => { components.forEach(component => {
if (Array.isArray(component.middleware)) {
middleware.push(...component.middleware) let compMiddleware
if (component.middleware) {
compMiddleware = component.middleware
} else if (component.default && component.default.middleware) {
compMiddleware = component.default.middleware
}
if (Array.isArray(compMiddleware)) {
middleware.push(...compMiddleware)
} else { } else {
middleware.push(component.middleware) middleware.push(compMiddleware)
} }
}) })