mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
fix: Handle middleware fn in nuxt.config.js
This commit is contained in:
parent
23919a9e01
commit
e97bb1d099
@ -101,7 +101,7 @@ export default async ssrContext => {
|
||||
/*
|
||||
** Call global middleware (nuxt.config.js)
|
||||
*/
|
||||
let midd = <%= serialize(router.middleware, { isJSON: true }) %>
|
||||
let midd = <%= serialize(router.middleware).replace('middleware(', 'function(') %>
|
||||
midd = midd.map((name) => {
|
||||
if (typeof name === 'function') return name
|
||||
if (typeof middleware[name] !== 'function') {
|
||||
|
@ -19,7 +19,7 @@ Options.from = function (_options) {
|
||||
if (options.loading === true) {
|
||||
delete options.loading
|
||||
}
|
||||
if (options.router && typeof options.router.middleware === 'string') {
|
||||
if (options.router && options.router.middleware && !Array.isArray(options.router.middleware)) {
|
||||
options.router.middleware = [options.router.middleware]
|
||||
}
|
||||
if (options.router && typeof options.router.base === 'string') {
|
||||
|
Loading…
Reference in New Issue
Block a user