Add app in store only if store exists

This commit is contained in:
Sébastien Chopin 2017-08-29 21:04:14 +02:00
parent b00592f157
commit 8dd1bfe169

View File

@ -50,7 +50,7 @@ async function createApp (ssrContext) {
// making them available everywhere as `this.$router` and `this.$store`. // making them available everywhere as `this.$router` and `this.$store`.
const app = { const app = {
router, router,
<% if (store) { %> store,<% } %> <% if (store) { %>store,<% } %>
_nuxt: { _nuxt: {
defaultTransition, defaultTransition,
transitions: [ defaultTransition ], transitions: [ defaultTransition ],
@ -86,10 +86,10 @@ async function createApp (ssrContext) {
}, },
...App ...App
} }
<% if (store) { %>
// Make app available in store // Make app available in store
store.app = app store.app = app
<% } %>
const next = ssrContext ? ssrContext.next : location => app.router.push(location) const next = ssrContext ? ssrContext.next : location => app.router.push(location)
let route let route
if (ssrContext) { if (ssrContext) {