title: How to get access to store from action in VueJS?
body: <p>Im using VueJS and Vuex. I have the userid into the store, this way:
  <a href="https://i.stack.imgur.com/iKVpL.png" rel="nofollow noreferrer">vuex screenshot</a></p>
  
  <p>And i try pass the userid to a fetch, but vuejs return error </p>
  
  <blockquote>
    <p>([Vue warn]: Error in created hook: "TypeError: this.$store is
    undefined")</p>
  </blockquote>
  
  <pre><code>import { LOAD_APPOINTMENTS } from './types'
  
  export default {
    loadProducts ({ commit }) {
      var user = this.$store.state.user.userid
      fetch('api/appointments/' + user)
        .then((result) =&gt; {
          return result.json()
        })
        .then((appointments) =&gt; {
          commit(LOAD_APPOINTMENTS, appointments)
        })
        .catch(er =&gt; {
          console.log(er)
        })
    }
  }
  </code></pre>