BulletProofMeteor icon indicating copy to clipboard operation
BulletProofMeteor copied to clipboard

Update iron router method

Open ryanbuiltthat opened this issue 9 years ago • 0 comments

A small tweak, in router.js is needed to reflect changes in the iron router hooks:

( remove the pause argument/callback and add this.next() )

var requireLogin = function() {
    if (!Meteor.userId()) {
        if (Meteor.loggingIn()) {
            this.render(this.loadingTemplate);
        }
        else {
            this.render('introduction');
        }
        //pause();

    }
    this.next();
}

var requireAdmin = function() {
    if (!Meteor.user() && Roles.userIsInRole(Meteor.userId(), ['admin'])) {
        if (Meteor.loggingIn()){
            this.render(this.loadingTemplate);
        }
        else {
            this.render('introduction');
        }
        //pause();

    }
    this.next();
}

Thanks for the tutorial! Great help to starting out with Meteor!

ryanbuiltthat avatar Mar 22 '15 02:03 ryanbuiltthat