1.2.0 • Published 3 months ago

@programic/vue-router-middleware v1.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 months ago

@programic/vue-route-middleware

Make complex global route middleware logic look easy and readable!

Installation:

npm i @programic/vue-route-middleware

yarn add @programic/vue-route-middleware

Basic Usage:

Set middleware meta key to your route and add our component to any vue router guard hook.

import { withPipeline } from '@programic/vue-route-middleware';
import middlewares from '..';

...
const router = withPipeline(createRouter({
  ...
}), middlewares);

createApp(App).use(router);

NOTICE: Middleware function will retrieve all the variables normally passed to the router guards
Example: (to, from, next) in case of beforeEach or (to, from) in case of afterEach guard.

router.js

import AuthMiddleware from './route/middleware/auth';
...
meta: {
    middleware: [ AuthMiddleware ]
}
...

Credits:

1.2.0

3 months ago

1.1.0

11 months ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago