change routing
This commit is contained in:
parent
8a34c1ab09
commit
08b1b1ef6d
29
hourglass/lib/router.js
Normal file
29
hourglass/lib/router.js
Normal file
@ -0,0 +1,29 @@
|
||||
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"
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user