Static GitHub Issues

[2886] vuex store problem in layout

prev: How to import external component with external store
next: How to allow ES6 imports in nuxt.config.js file?

Hello

Here is my old simple vuejs code which is working perfect

<template>
  <div id="app" v-if="$store.state.isUserLoggedIn">
    <page-header />
    <div id="content-wrapper">
      <left-header />
      <router-view></router-view>
    </div>
  </div>
  <div id="app" class="app" v-else>
    <div id="content-wrapper-login">
      <router-view></router-view>
    </div>
  </div>
</template>

But the same thing is not working in NUXT. Here is my nuxt code

<template>
  <div v-if="$store.state.isUserLoggedIn">
    <page-header />
    <div id="content-wrapper">
      <left-header />
      <nuxt/>
    </div>
  </div>
  <div v-else class="app">
    <div id="content-wrapper-login">
      <nuxt/>
    </div>
  </div>
</template>

Would you please help me how to access store in layout file?

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2508">#c2508</a>)</em></sub></div>