npm.io
0.0.3 • Published 9 years ago

vue-sellsuki-auth

Licence
ISC
Version
0.0.3
Deps
0
Vulns
0
Weekly
0
Stars
1

Sellsuki Auth

Plugin for request authentication from Sellsuki login.

Requirement

  • vue
  • vue-router

Initiate

Initiate plugin by Vue.use after VueRouter with target url and router

import Vue from 'vue'
import VueRouter from 'vue-router'
import SellsukiAuth from 'vue-sellsuki-auth'

...

var router = new VueRouter({
  routes: [
    { path: '/hello', component: Hello },
    { path: '*', redirect: Home }
  ]
})

Vue.use(SellsukiAuth, {target: 'loginURL', router: router})

AuthChecker

Plugin will validate authentication from cookies in local

router.beforeEach((to, from, next) => {
  Vue.prototype.$sellsuki_auth.authChecker(next)
})