[Vuejs]-Call vuex getters from Vue-Router

0👍

There was a discussion on this here: https://github.com/vuejs/vuex-router-sync/issues/3#issuecomment-200192468

I was able to access the variable in a fairly ridiculous way:

router.beforeEach((transition)=>{
    if(transition.to.auth){
        if(!transition.to.router.app.$store.state.auth.authorized){
            transition.abort()
            router.go({path:"/"})
        }
    }
    transition.next()
});

So in your case it might look like to.router.app.$store.state

Leave a comment