fix: Show error page if error on layout

This commit is contained in:
Sébastien Chopin 2018-08-21 16:50:31 +02:00
parent b9f3aa27c9
commit bba9e2bae0

View File

@ -123,6 +123,7 @@ export default async (ssrContext) => {
let layout = Components.length ? Components[0].options.layout : NuxtError.layout let layout = Components.length ? Components[0].options.layout : NuxtError.layout
if (typeof layout === 'function') layout = layout(app.context) if (typeof layout === 'function') layout = layout(app.context)
await _app.loadLayout(layout) await _app.loadLayout(layout)
if (ssrContext.nuxt.error) return renderErrorPage()
layout = _app.setLayout(layout) layout = _app.setLayout(layout)
// ...Set layout to __NUXT__ // ...Set layout to __NUXT__
ssrContext.nuxt.layout = _app.layoutName ssrContext.nuxt.layout = _app.layoutName