mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
fix(layout-middleware): Fix issue #4724
This commit is contained in:
parent
2bde11f77d
commit
521ac20e29
@ -196,8 +196,9 @@ function callMiddleware(Components, context, layout) {
|
||||
// If layout is undefined, only call global middleware
|
||||
if (typeof layout !== 'undefined') {
|
||||
midd = [] // Exclude global middleware if layout defined (already called before)
|
||||
if (layout.middleware) {
|
||||
midd = midd.concat(layout.middleware)
|
||||
const layoutMiddleware = layout.middleware || layout.options.middleware
|
||||
if (layoutMiddleware) {
|
||||
midd = midd.concat(layoutMiddleware)
|
||||
}
|
||||
Components.forEach((Component) => {
|
||||
if (Component.options.middleware) {
|
||||
|
@ -136,7 +136,8 @@ export default async (ssrContext) => {
|
||||
** Call middleware (layout + pages)
|
||||
*/
|
||||
midd = []
|
||||
if (layout.middleware) midd = midd.concat(layout.middleware)
|
||||
const layoutMiddleware = layout.middleware || layout.options.middleware
|
||||
if (layoutMiddleware) midd = midd.concat(layoutMiddleware)
|
||||
Components.forEach((Component) => {
|
||||
if (Component.options.middleware) {
|
||||
midd = midd.concat(Component.options.middleware)
|
||||
|
Loading…
Reference in New Issue
Block a user