title: Sync store with cookies in nuxtServerInit - NuxtJS
body: <p>I'm using NuxtJS's auth module and trying to get the Bearer token and a custom cookie that contains a sessionType on nuxtServerInit so I can update the <code>store</code> with a <code>mutation</code>, but it only works when I reload the page.</p>
  
  <p>If I close the browser and go directly to my app url, I keep getting undefined for auth._token.local because <code>nuxtServerInit</code> executes before the cookies are ready.</p>
  
  <p>My code in store/index.js looks like this:</p>
  
  <pre><code>export const actions = {
    async nuxtServerInit({ commit, dispatch }, { req }) {
      // Parse cookies with cookie-universal-nuxt
      const token = this.$cookies.get('token')
      const sessionType = this.$cookies.get('sessionType')
  
     // Check if Cookie user and token exists to set them in 'auth'
      if (token &amp;&amp; user) {
        commit('auth/SET_TOKEN', token)
        commit('auth/SET_SESSION_TYPE', user)
      }
    }
  }
  </code></pre>
  
  <p>I'm using nuxt-universal-cookies library.</p>
  
  <p>What's the way to execute the action after the cookies are loaded on the browser?</p>