mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
hotfix(layout): Hot fix for layout middleware
This commit is contained in:
parent
521ac20e29
commit
3ebd6b707e
@ -196,9 +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)
|
||||
const layoutMiddleware = layout.middleware || layout.options.middleware
|
||||
if (layoutMiddleware) {
|
||||
midd = midd.concat(layoutMiddleware)
|
||||
layout = sanitizeComponent(layout)
|
||||
if (layout.options.middleware) {
|
||||
midd = midd.concat(layout.options.middleware)
|
||||
}
|
||||
Components.forEach((Component) => {
|
||||
if (Component.options.middleware) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { stringify } from 'querystring'
|
||||
import Vue from 'vue'
|
||||
import middleware from './middleware.js'
|
||||
import { applyAsyncData, getMatchedComponents, middlewareSeries, promisify, urlJoin } from './utils.js'
|
||||
import { applyAsyncData, getMatchedComponents, middlewareSeries, promisify, urlJoin, sanitizeComponent } from './utils.js'
|
||||
import { createApp, NuxtError } from './index.js'
|
||||
import NuxtLink from './components/nuxt-link.server.js' // should be included after ./index.js
|
||||
|
||||
@ -136,8 +136,8 @@ export default async (ssrContext) => {
|
||||
** Call middleware (layout + pages)
|
||||
*/
|
||||
midd = []
|
||||
const layoutMiddleware = layout.middleware || layout.options.middleware
|
||||
if (layoutMiddleware) midd = midd.concat(layoutMiddleware)
|
||||
layout = sanitizeComponent(layout)
|
||||
if (layout.options.middleware) midd = midd.concat(layout.options.middleware)
|
||||
Components.forEach((Component) => {
|
||||
if (Component.options.middleware) {
|
||||
midd = midd.concat(Component.options.middleware)
|
||||
|
Loading…
Reference in New Issue
Block a user