Pls what better way could I write this piece of code, I have read the documentation but I don’t understand it or can’t find a specific example that reflect what I want to do.
Router.route('/', function () {
this.render('Home');
});
Router.route('/admin', function () {
if (!Meteor.userId()) {
this.render('loginpage');
}
this.next();
if (Meteor.user().profile.role=="admin"){
this.render('administrator');
}
this.next();
if (Meteor.user().profile.role=="assessor"){
this.redirect('/assessor');
}
});
Router.route('/assessor', function () {
if (!Meteor.userId()) {
this.render('loginpage');
}
this.next();
if (Meteor.user().profile.role=="assessor"){
this.render('assessor');
}
this.next();
if (Meteor.user().profile.role=="admin"){
this.redirect('/admin');
}
});