Answer the question
In order to leave comments, you need to log in
How to respond to parameter changes in the vuex store in vue-router?
In store I keep the parameter isLogged
(true/false), which means whether the user is logged in.
Its state can change from several places: both by the "Exit" button, and by the server's response to the next request, and by timeout.
How best to do so that when the state changes to "logged out", the user is redirected to a specific route?
As far as I understand, shove into store.mutations
something besides changing the store is not kosher. So how to be?
Answer the question
In order to leave comments, you need to log in
There is no way to do this in the router itself. You have some main component that contains a router inside. Here in this component and monitor the state of this parameter.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question