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`.
const app = {
router,
<% if (store) { %> store,<% } %>
<% if (store) { %>store,<% } %>
_nuxt: {
defaultTransition,
transitions: [ defaultTransition ],
@ -86,10 +86,10 @@ async function createApp (ssrContext) {
},
...App
}
<% if (store) { %>
// Make app available in store
store.app = app
<% } %>
const next = ssrContext ? ssrContext.next : location => app.router.push(location)
let route
if (ssrContext) {