-
- Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
hi Akryum
I made a new project with Meteor and vue js
Now I want to be a guardian for registration and login and user panel, but this project does not work and it does not work.
Rouetrs : src/routes.js
export default [ { path: '/login', name: 'login', component: Login, meta: { forVisitor : true, } }, { path: '/register', name: 'Register', component: Register, meta: { forVisitor : true, } }, { path: '/user', name: 'DashboardPerson', component: DashboardPerson, meta: { forAuth : true, } }, ]
code guard : src/app.js
router.beforeEach((to, from, next) => { console.log('Meteor', Meteor.userId()) if (to.matched.some(record => record.meta.forVisitor)) { if (Meteor.userId()) { next('/user') } } if (to.matched.some(record => record.meta.forAuth)) { if (!Meteor.userId()) { next('/login') } } })
Thank you for helping me .
mehrdadphp and gustawdaniel
Metadata
Metadata
Assignees
Labels
No labels