title: Can I call commit from one of mutations in Vuex store
body: <p>I have a <a href="https://vuex.vuejs.org/en/intro.html" rel="noreferrer">vuex</a> store, like following:</p>
  
  <pre><code>import spreeApi from '../../gateways/spree-api'
  // initial state
  const state = {
    products: [],
    categories: []
  }
  
  // mutations
  const mutations = {
   SET_PRODUCTS: (state, response) =&gt; {
     state.products = response.data.products
     commit('SET_CATEGORIES')
   },
   SET_CATEGORIES: (state) =&gt; {
     state.categories = state.products.map(function(product) { return product.category})
   }
  
  }
  
  const actions = {
   FETCH_PRODUCTS: (state, filters) =&gt; {
     return spreeApi.get('products').then(response =&gt; state.commit('SET_PRODUCTS', response))
   }
  }
  
  export default {
    state,
    mutations,
    actions
  }
  </code></pre>
  
  <p>I want to call mutation: <code>SET_CATEGORIES</code> from mutation: <code>SET_PRODUCTS</code>, But this gives me error: </p>
  
  <blockquote>
    <p>projectFilter.js:22 Uncaught (in promise) ReferenceError: commit is not defined(…)</p>
  </blockquote>
  
  <p>What should be correct way to do this. I tried <code>store.commit</code> and <code>this.commit</code>, but these also gave similar errors.</p>