0👍
You should try to use middleware
. It is the conventional way to implement the beforeEach
function as mentioned by the official docs. You can read about it from here. If have access to the route
object, store
object and redirect
function inside the middleware, so use redirect
to direct to the other routes after validation.
Source:stackexchange.com