Reputation: 383
I want to check if the data is in store before every router change, if the data is not in the vuex, i want to use vuex's actions to get the data from server. so how can i user actions in beforeEach.
i use the vue2.0
Upvotes: 1
Views: 1550
Reputation: 13674
All you have to do is import store from '/vuex
and actions
Depends how you built your actions you can be pushed to pass store instance to action.
Other than that - it is straight forward.
Upvotes: 2