0.5.0 • Published 5 years ago

@samhammer/vue-middleware-pipelines v0.5.0

Weekly downloads
7
License
MIT
Repository
-
Last release
5 years ago

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.

0.5.0

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago