archive/hourglass/lib/router.js
2016-08-12 17:18:30 -04:00

30 lines
602 B
JavaScript

Router.route('/', function() {
if (!Meteor.userId()) {
this.redirect('/login');
} else {
this.render("main");
}
});
Router.route('/login', function() {
if (!Meteor.userId()) {
this.render("login");
} else if (Object.keys(Meteor.user().profile).length <= 1) {
this.redirect('/profile');
} else {
this.redirect('/');
}
});
Router.route('/profile', function() {
if (!Meteor.userId()) {
this.redirect("/login");
} else {
this.render("profile");
}
});
Router.configure({
notFoundTemplate: "NotFound"
});