Skip to content

Instantly share code, notes, and snippets.

@wbashir
Created September 1, 2013 23:30
Show Gist options
  • Save wbashir/6408003 to your computer and use it in GitHub Desktop.
Save wbashir/6408003 to your computer and use it in GitHub Desktop.
Controller - Extend so user is/isn't authorized with reactive computation.
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