Iron Router / Meteor : Except not working -
i trying login process work. basically, routes should redirected "/login" if user not logged in. except "/signup" , "/reset", because wont logged in if go there.
router.configure({ layouttemplate: 'layout' }); router.onbeforeaction(function () { except: ['signup','reset'] if (!meteor.userid()) { // if user not logged in, render login template this.render('login'); } else { this.next(); } }); router.route('/', function (){ this.render('app-main-page'); }); router.route('/signup', function () { this.render('signup');}, { name:'signup' }); router.route('/reset', function () { this.render('reset');}, { name:'reset' }); // , bunch of more routes within app });
in general onbeforeaction working, when not logged in login template rendered. however, "except" part not working, means users cannot sign since redirected login page. have insights? seems extremely simple piece of code, have absolutely no idea have made error.
onbeforeaction: function() { .. this.next(); }
use this,nexr()
leave onbeforeaction
,
Comments
Post a Comment