Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 382 Bytes

vuerouter.md

File metadata and controls

22 lines (18 loc) · 382 Bytes

VueAuth with VueRouter

First, pass router into Vue.use when setting up vue-auth

Vue.use(Auth, {
	router
})

Then define which routes require auth:

const routes = [{
	path: '/',
	component: require('./Home.vue')
},{
	path: '/protected',
	component: require('./ProtectMe.vue')
	meta: { auth: true } // I need auth
}]