Fix: error on template for layout when redirected

This commit is contained in:
Sébastien Chopin 2017-06-04 19:59:36 +02:00
parent b26d3d6b6f
commit ce69c3be0f

View File

@ -19,6 +19,7 @@ const isDev = <%= isDev %>
export default async (context) => {
const { app, router<%= (store ? ', store' : '') %> } = await createApp(context)
const _app = new Vue(app)
const _noopApp = new Vue({ render: (h) => h('div') })
// Add store to the context
<%= (store ? 'context.store = store' : '') %>
// Add route to the context
@ -82,7 +83,7 @@ export default async (context) => {
if (!context.nuxt.error) {
await middlewareSeries(midd, ctx)
}
if (context.redirected) return _app
if (context.redirected) return _noopApp
// Set layout
let layout = Components.length ? Components[0].options.layout : NuxtError.layout
if (typeof layout === 'function') layout = layout(ctx)
@ -107,7 +108,7 @@ export default async (context) => {
if (!context.nuxt.error) {
await middlewareSeries(midd, ctx)
}
if (context.redirected) return _app
if (context.redirected) return _noopApp
// Call .validate()
let isValid = true
Components.forEach((Component) => {