-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Redirect from groups? #182
Comments
I think you can do the same with groups. Create a group for var adminRoutes = FlowRouter.group({
prefix: '/admin'
});
adminRoutes.route('/', {
triggersEnter: [function(contex, redirect) {
redirect('/admin/users');
}];
});
adminRoutes.route('/users', {
action: function() {
console.log("Yeah, I'm on /users");
}
}); |
Hi, Thanks for the reply, that will indeed work for me. The I have a suggestion: Could we pass in As another observation, can the "already redirected" Error be triggered? Wouldn't the return on #L82 exit the runTriggers function? |
I've had a little play: Changing the Triggers.runTriggers(
triggers,
self._current,
_.bind(self.go, self),
afterAllTriggersRan
); Admin = FlowRouter.group({
prefix: '/admin'
});
Admin.route('/', {
triggersEnter: [function(context, redirect) {
redirect('admin.users');
}]
}); I haven't done any in depth testing, can you think of nay reason you wouldn't want to allow route names in this situation? Thanks for your time. |
Okay. I got it. Let's see what we can do here. |
Implemented this and release with |
👍 Thanks for your fast response! Updating now! |
I've been looking at using groups to organise my routes, and one feature which appears to be missing from the groups is the ability to redirect to a route if the URL defined by the group is hit.
Consider the following pages:
All of these pages are to be housed under the
/admin
section of the application. Using just routes I have done the following:Using a group, if I navigate to
/admin
I can't find a way of redirecting to/admin/users
.Is this a feature which could be added, or should I carry on defining my routes as I have been?
Thanks
The text was updated successfully, but these errors were encountered: