Provides the ability to specify multiple guards for vue routes
npm install vue-router-multiguardnpm install vue-router-multiguard
next() with an argument other than undefined.
next() with an argument other than undefined, that argument will be passed to VueRouter.
multiguard(function[] guards) -> function(to, from, next) {... }
js
import VueRouter from 'vue-router';
import multiguard from 'vue-router-multiguard';
const guard1 = function(to, from, next) {
console.log('guard1 called');
next();
}
const guard2 = function(to, from, next) {
console.log('guard2 called');
next();
}
const router = new VueRouter({
routes: [
{
name: 'home',
path: '/',
component: {},
beforeEnter: multiguard([guard1, guard2]),
}
]
});
`
Running the tests
npm test`