Add context.serverStoreState

This commit is contained in:
Sebastien Chopin 2017-08-31 14:46:06 +02:00
parent e2a18d76da
commit 7da8785d72

View File

@ -108,6 +108,11 @@ export function getContext (context, app) {
if (ctx.isServer && context.beforeRenderFns) { if (ctx.isServer && context.beforeRenderFns) {
ctx.beforeNuxtRender = (fn) => context.beforeRenderFns.push(fn) ctx.beforeNuxtRender = (fn) => context.beforeRenderFns.push(fn)
} }
<% if (store) { %>
if (ctx.isClient && window.__NUXT__ && window.__NUXT__.state) {
ctx.serverStoreState = window.__NUXT__.state
}
<% } %>
return ctx return ctx
} }