title: VUEX Response of Dispatch VUE
body: <p>How can I catch the response of a vuex dispatch from another component? So in case the response, for example, is 200 I do something else.
  component.vue</p>
  <pre class="lang-js prettyprint-override"><code>this.$store.dispatch(&quot;setTrigger&quot;);
  </code></pre>
  <p>store.js</p>
  <pre class="lang-js prettyprint-override"><code>
      setTrigger({ state }) {
        axios
          .post(
            &quot;https://xxx.us/api/savetriggers&quot;,
            {
              organizationsDefaultTriggerTime: state.organizationsDefaultTriggerTime,
              runFailedDefaultTriggerTime: state.runFailedDefaultTriggerTime,
            },
            {
              headers: {
                Authorization: `Bearer ${state.currentAuthToken}`,
              },
            }
          )
          .then((response) =&gt; {
            console.log(response.data);
          })
          .catch((error) =&gt; {
            console.log(error.data);
          });
      },
  
  </code></pre>
  <p>The setTrigger is in the store.js and I call dispatch from within a component.</p>
  <p>Should I use states and getters also ? Is this the best practice?</p>