We'll try to create and use middlewares for Vue Router in diffetent way, we'll start with the simpliest then dive deeper!
Read More about here, It give us 3 option to work with routes, beforeEnter/beforeLeave/beforeRouteUpdate it's check request before accessing the route then you can decide what to do with it, but you can't triget what's going there in beforeEnter/Leave, you can watch the $route in watch method or in beforeRouteUpdatem a simple example is like this:
const router = new VueRouter({
mode: 'history',
routes: [
{