From ce69c3be0f544afa9b36b23b9e106631c9c51f70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Sun, 4 Jun 2017 19:59:36 +0200 Subject: [PATCH] Fix: error on template for layout when redirected --- lib/app/server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/app/server.js b/lib/app/server.js index 0bba819264..5e0f1b5109 100644 --- a/lib/app/server.js +++ b/lib/app/server.js @@ -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) => {