I have the following Vuex store (main.js):
import Vue from \'vue\'
import Vuex from \'vuex\'
Vue.use(Vuex)
//init sto
Managing your location state separate from the rest of your application state can make things like this harder than they maybe need to be. After dealing with similar problems in both Redux and Vuex, I started managing my location state inside my Vuex store, using a router module. You might want to think about using that approach.
In your specific case, you could watch for when the location changes within the Vuex store itself, and dispatch the appropriate "redirect" action, like this:
dispatch("router/push", {path: "/login"})
It's easier than you might think to manage the location state as a Vuex module. You can use mine as a starting point if you want to try it out:
https://github.com/geekytime/vuex-router