title: Persisted state from VueX and NuxtJS
body: <p>I use vuex-persistedstate package (<a href="https://github.com/robinvdvleuten/vuex-persistedstate" rel="noreferrer">https://github.com/robinvdvleuten/vuex-persistedstate</a>) to persist data state on browser.</p>
  
  <p>I use Adonuxt (a mix between NuxtJS and AdonisJS).</p>
  
  <p>In VueX actions, I have this action:</p>
  
  <pre><code>nuxtClientInit ({commit}) {
        // I want get here state auth saved by persistedstate package
      }
  </code></pre>
  
  <p>This action is called by plugin:</p>
  
  <p>localstorage.js</p>
  
  <pre><code>export default async (context) =&gt; {
    await context.store.dispatch('nuxtClientInit', context)
  }
  </code></pre>
  
  <p>nuxt.js plugin (config)</p>
  
  <pre><code>{
        src: '~/plugins/localstorage.js',
        ssr: false
      }
  </code></pre>
  
  <p>I want get state to configure Axios with the user token:</p>
  
  <pre><code>this.$axios.setToken(auth.jwt.token, 'Bearer')
  </code></pre>
  
  <p>I have the impression nuxtClientInit() is called before persistedstate package, so <code>state.auth</code> is null but it can observable in console:</p>
  
  <p><img src="https://user-images.githubusercontent.com/1739235/37842049-6bef1ad8-2ec1-11e8-9296-fe1caef78bac.png" alt="image"></p>