Fix middlewares
This commit is contained in:
parent
bf64c01646
commit
2b02667f34
|
@ -182,11 +182,19 @@ function resolveComponents (components) {
|
|||
function getMiddleware (components) {
|
||||
const middleware = [...globalMiddleware]
|
||||
|
||||
components.filter(c => c.middleware).forEach(component => {
|
||||
if (Array.isArray(component.middleware)) {
|
||||
middleware.push(...component.middleware)
|
||||
components.forEach(component => {
|
||||
|
||||
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 {
|
||||
middleware.push(component.middleware)
|
||||
middleware.push(compMiddleware)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue