🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@samhammer/vue-middleware-pipelines

Package Overview
Dependencies
Maintainers
5
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@samhammer/vue-middleware-pipelines

possibility to add middleware logic to the vue router

latest
npmnpm
Version
0.5.0
Version published
Maintainers
5
Created
Source

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.

FAQs

Package last updated on 22 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts