lesson 184: route meta

This commit is contained in:
Andreas Zweili 2021-05-04 16:35:48 +02:00
parent e6545dd015
commit 904fe565f5
1 changed files with 7 additions and 2 deletions

View File

@ -13,6 +13,9 @@ const router = createRouter({
{
name: 'teams',
path: '/teams',
meta: {
needsAuth: true
},
component: TeamsList,
children: [
{
@ -34,8 +37,10 @@ const router = createRouter({
}
});
router.beforeEach(function(to, from, next) {
console.log(to, from);
router.beforeEach(function(to, _2, next) {
if (to.meta.needsAuth) {
console.log('Needs authentication.');
}
// if (to.name === 'team-members') {
// next();
// } else {