title: How do I properly get the state data set with nuxtServerInit in Nuxt
body: <p>I have a situation where I get data from api in nuxtServerInit and write it to the store's state variable like so</p>
  <pre><code> let categoriesService = new Categories(this.$axios);
      categoriesService.current().then((resp) =&gt; {
        if (resp.data.success) {
          const navCategoryRoutes = resp.data.items
            .filter((item) =&gt; {
              return item.label !== &quot;&quot; &amp;&amp; item.label;
            })
            .map((item) =&gt; {
              item.label = item.label.toLowerCase();
              item.isSelected = false;
              item.url = &quot;/category/&quot; + item.name + &quot;/&quot;;
              return item;
            });
          commit(&quot;nav/setNavCategoryRoutes&quot;, navCategoryRoutes);
        }
      });
  </code></pre>
  <p>I log it in the setter to the console and I can see that below the assignment declaration and I can see it's there</p>
  <pre><code>  state: {
      categoryRoutes: [
        [Object],
        [Object],
        [Object],
        [Object],
        [Object]
      ]
    },
  </code></pre>
  <p>In the getter, however, it's always an empty array ;/</p>
  <pre><code>export const getters = {
    getNavCategoryRoutes(state) {
      console.log({ getter: state });
      return state.categoryRoutes;
    },
  };
  </code></pre>
  <pre><code>  getter: {
      categoryRoutes: []
    }
  </code></pre>
  <p>and in the file where I try to use it obviously it is empty as well</p>
  <pre><code>    categories() {
        console.log({
          header: this.$store.getters[&quot;nav/getNavCategoryRoutes&quot;],
        });
        return this.$store.getters[&quot;nav/getNavCategoryRoutes&quot;];
      },
  </code></pre>
  <p>I have tried to fetch it in computed property:</p>
  <pre><code>  computed: {
      categories() {
        return this.$store.getters[&quot;nav/getNavCategorysRoutes&quot;];
      },
    },
  </code></pre>
  <p>and in the mounted lifecycle method:</p>
  <pre><code>  mounted() {
      this.categories = this.$store.getters[&quot;nav/getNavCategoryRoutes&quot;];
    },
  </code></pre>
  <p>But the problem is earlier in the getter I think, I just don't know what am I doing wrong ;/ this getter is no different from the working ones. Would you please point me in the proper direction, I am out of ideas about what to do with that, thanks a lot.</p>