vue-router-multiguard
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    12,117
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    12,117
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i vue-router-multiguard

Weekly Downloads

9,457

Version

1.0.3

License

MIT

Last publish

Collaborators

  • atanas-angelov-dev