Home

Issue: 2886

vuex store problem in layout

[issue link]

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?

This question is available on Nuxt.js community (#c2508)