title: Is it possible to use Vuex mapActions inside an exported module
body: <p>Is it possible to call Vuex mapActions from a separate module that's imported into a component?</p>
  
  <p>I'm trying to standardize a set of functions in a vue.js web app. I'd like to import them into each component and pass some values the to function operate. I'm using vuex to manage state. Currently each component calls these functions each time they're loaded (identically the same). </p>
  
  <p>I'd like to refactor into this into one module and import it into each component as needed. This code uses mapActions as part of it's function. Below are the relevant pieces of code: component, module, vuex action</p>
  
  <p>Vue component:</p>
  
  <pre><code>//the imported function call
  if (!this.queued){
     timer.updatePage(this.pagination, this.orders);
  }
  </code></pre>
  
  <p>the module code (advance.js):</p>
  
  <pre><code>import { mapActions } from 'vuex';
  
  let currentComp = {
     name: 'purchase',
     date: null,
     start: false
  }
  
  const timer = {
     ...mapActions(['currentComponent']),
     updatePage(pagination, order) {
        currentComp.name = 'nextComponent';
        this.currentComponent(currentComp);
     }
  }
  export default timer;
  </code></pre>
  
  <p>the vuex code:</p>
  
  <pre><code>//in the actions section:
  currentComponent({
          commit
      }, comp) {
          console.log(comp);
          commit('setCurrentComponent', comp);
  }
  
  //in the mutations section:
  setCurrentComponent: (state, comp) =&gt; {
          state.currentComponent = comp.name;
          return state;
      }
  </code></pre>
  
  <p>when the component runs the imported function i get:</p>
  
  <pre><code>vuex.esm.js?2f62:870 Uncaught TypeError: Cannot read property 'dispatch' of undefined
      at Object.mappedAction [as currentComponent] (vuex.esm.js?2f62:870)
      at eval (advance.js?935c:37)
  </code></pre>
  
  <p>when i remove the this from this.currentComponent i get:</p>
  
  <pre><code>advance.js?935c:37 Uncaught ReferenceError: currentComponent is not defined
      at eval (advance.js?935c:37)
  </code></pre>
  
  <p>thanks in advance for any guidance.</p>