title: How to navigate using vue router from Vuex actions
body: <p>I am creating a web app with Vue 2.x and Vuex 2.x. I am fetching some information from a remote location via an http call, I want that if that call fails I should redirect to some other page.</p>
  
  <pre><code>GET_PETS: (state) =&gt; {
    return $http.get('pets/').then((response)=&gt;{
        state.commit('SET_PETS', response.data)
      })
    },
    error =&gt; {this.$router.push({path:"/"}) }
    )
  }
  </code></pre>
  
  <p>But <code>this.$router.push({path:"/"})</code> gives me following error.</p>
  
  <blockquote>
    <p>Uncaught (in promise) TypeError: Cannot read property 'push' of undefined</p>
  </blockquote>
  
  <p>How can this be achieved.</p>
  
  <p>Simulated JsFiddle: <a href="https://jsfiddle.net/pukx3heb/1/" rel="noreferrer">here</a></p>