michaelolof / vuex-class-component

A Type Safe Vuex Module or Store Using ES6 Classes and ES7 Decorators written in TypeScript.
217 stars 21 forks source link

Accessing Nuxt Router inside Vuex module #33

Open domi91c opened 5 years ago

domi91c commented 5 years ago

I've been trying out this package in a Nuxt app, and I'm just trying to find a way to change paths with Vue Router inside a Vuex action. Normally that would be with this.$router.push('...'), but I can't access this.$router inside the Vuex module. Can anyone let me know if this is possible?

mbale commented 5 years ago

You can access the store through this.$store, so you have the context that includes the redirect method