diff --git a/2021-03-27_routing-01-starting-setup/src/main.js b/2021-03-27_routing-01-starting-setup/src/main.js index d0f3ef4..e3da6d0 100644 --- a/2021-03-27_routing-01-starting-setup/src/main.js +++ b/2021-03-27_routing-01-starting-setup/src/main.js @@ -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 {