Created
September 1, 2013 23:30
-
-
Save wbashir/6408003 to your computer and use it in GitHub Desktop.
Controller - Extend so user is/isn't authorized with reactive computation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MyController = RouteController.extend({ | |
before: function () { | |
var onReady = function () { | |
if (/* whatever */) | |
this.render(); | |
}; | |
var onWait = function () { | |
// maybe show a loading or logging in function. | |
}; | |
if (Meteor.user()) { | |
return this.wait(userDataSubscriptionHandle, onReady, onWait); | |
} else { | |
this.render('notAuthorized'); | |
this.stop(); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment