title: Share code in asyncData and mounted using Nuxt
body: <p>I want to share same code block to get data in asyncData and mounted using Nuxt.</p>
  
  <p>For example in <code>asyncData</code></p>
  
  <pre><code>  async asyncData({ $api, $auth, route, error, store }) {
      if( !process.server ) return null;
      let res = {};
      let stockData = await $api.stocks.getStock(route.params.name);
      if( stockData ) { res.stockData = stockData.data; }
      return res;
    },
  </code></pre>
  
  <p>And in <code>mounted()</code></p>
  
  <pre><code>if(ObjectHelper().isEmpty( this.stockData )) {
    this.$api.stocks.getStock(route.params.name).then(res =&gt; {
      this.stockData = res.data;
    })
  }
  </code></pre>
  
  <p>Those two code blocks are all getting data from server-side. How to write a common function to reuse it but not write twice? In nuxt documents, <code>You do NOT have access of the component instance through this inside asyncData because it is called before initiating the component.</code></p>