Accessing router instance in Vuex store
See original GitHub issueWith the new best practices for SSR implemented into this app, the store and router instances are generated by createStore()
and createRouter()
respectively. As importing the router instance is no longer as simple as import router from '../router'
, is it still possible to achieve programmatic router navigation in the Vuex store?
Apologies if this is not the correct place for this question!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:10 (1 by maintainers)
Top Results From Across the Web
How to navigate using vue router from Vuex actions
import router from './router'. and use router.push. Simple like that.
Read more >How to access this.$router in actions - Vue Forum
Hi, i cant redirect a router from vuex actions this.$router is undefined axios.post(api_url, queryString.stringify(payload),{ headers: { 'Content-Type': ...
Read more >[SOLVED] Access Vuex store in router.js - Quasar forum
I want to access Vuex store in router.js (not index.js of route where we could use export default function ({ store }) )...
Read more >89. Accessing the store state data in the router ... - YouTube
89. Accessing the store state data in the router Navigation Guards in Vue router - Vue js 3 | Vue 3.
Read more >Use Vuex in Vue Router Navigation Guards - Michael Hoffmann
Vue Router allows us to define Navigation Guards. ... If you are using Vuex you probably store the authenticated state in the Vuex...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
you can pass the router instance as part of the action payload.
@trajano this is a pretty good alternative approach to at least getting router data in your vuex store: https://github.com/vuejs/vuex-router-sync