vue-router-multiguard

Provides the ability to specify multiple guards for vue routes
1,481,591 87
Install
npm install vue-router-multiguard
Latest Version:1.0.3
License:MIT
Last Updated:May 2, 2020
Links: GitHub  ·  npm
Maintainer: atanas-angelov-dev

Vue Router Multiguard Build Status

Provides the ability to specify multiple guards for vue router routes.

Installing

npm install vue-router-multiguard

Notes

  • Guards are executed serially in the order they are supplied.
  • Guard execution will stop when all passed guards are executed OR when any guard calls next() with an argument other than undefined.
  • When a guard calls next() with an argument other than undefined, that argument will be passed to VueRouter.

Usage

multiguard(function[] guards) -> function(to, from, next) {... }

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

License

This project is licensed under the MIT License - see the LICENSE file for details

Related Packages

vue-route-handler

Elegant, fluent route definitions for Vue Router, inspired by Laravel.

1,373 4
@web-types/vue-router

Web-types for vue-router

1,321,418 306
@fastkit/vue-location

vue-location

5,514 6
vue-routes-design

简化vue-router的路由配置

914 5
vuex-router-sync

Effortlessly keep vue-router and vuex store in sync.

4,091,575 2,487

Version History

Version Released License
1.0.3 MIT
1.0.2 MIT
1.0.1 MIT
1.0.0 MIT