This package has been deprecated

Author message:

This package is no longer maintained. Use vue-router-multiguard instead.

@samhammer/vue-middleware-pipelines
TypeScript icon, indicating that this package has built-in type declarations

0.5.0 • Public • Published

Vue-Middleware-Pipeplines

Possibility to add middleware logic to the vue router This package contains the routing logic of Dotunj. For more details see https://github.com/Dotunj/vue-middleware-pipelines

How to use

Register Middleware in router:

import routerMiddleware from './routerMiddleware';
...
routerMiddleware.registerMiddleware(router, AuthStore);

Write a function to set the next route (e.g. in a new module called authMiddleware):

import { Context } from '@samhammer/vue-middleware-pipelines';

export default function authMiddleware(context: Context): void {
    if (!context.store.getters.auth.isLoggedIn) {
        return context.next({
            name: 'login',
        });
    }

    return context.next();
}

Add middleware to route:

import authMiddleware from './authMiddleware';
...
    routes: [
    ...
        {
            path: '/agentchat',
            name: 'agentchat',
            component: () => import('@/views/AgentChat.vue'),
            meta: {
                middleware: [
                    authMiddleware,
                ],
            },
        },
    ...
    ]

How to publish

For publishing an npm account that is referenced to the organization is required.

See the following how to:

https://yarnpkg.com/en/docs/publishing-a-package

https://docs.npmjs.com/getting-started/publishing-npm-packages

If everything is configured correctly just count up the version number in our package.json and execute one of the following commands:

yarn run build
yarn publish

npm run build
npm publish --access public

License

vue-middleware-pipelines is released under the MIT License. See LICENSE file for details.

Readme

Keywords

none

Package Sidebar

Install

npm i @samhammer/vue-middleware-pipelines

Weekly Downloads

2

Version

0.5.0

License

MIT

Unpacked Size

6.33 kB

Total Files

8

Last publish

Collaborators

  • vijoplays
  • friedelbaumann
  • domi2120
  • datlam162
  • agentschmitt
  • npolauer
  • teranovalp
  • devroemer