Skip to content
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

Override AccountsTemplates.configureRoute #19

Open
raduchiriac opened this issue Nov 27, 2015 · 11 comments
Open

Override AccountsTemplates.configureRoute #19

raduchiriac opened this issue Nov 27, 2015 · 11 comments

Comments

@raduchiriac
Copy link

I am using a TelescopeApp (v0.25.5) and I need to edit the route paths and templates for "sign-in" and "sign-up". These are already declared under /telescope-users/lib/config.js

When I do:

AccountsTemplates.configureRoute('signIn', {
    name: 'landing',
    path: '/landingPage',
    template: 'landingPage'
});

I get an error saying: Route already configured!
Is there a way I can override a previously (from the packages) declared route?

@raduchiriac
Copy link
Author

I've managed to do this little "cleanup" before configuring my own route. Quite ugly IMO
delete AccountsTemplates.routes.signIn;

@splendido
Copy link
Member

the thing is that the first call to configureRoute actually set the route using the router API...
so, in principle, you should also cancel route configuration on the router: are you getting any problem with your current solution?

@raduchiriac
Copy link
Author

Nope. Deleting the key on that object gives you the option to "overwrite" an already set route.
I'm not sure if you can close this. Let's just say, I found a hack not a solution.
Thanks for a great package anyway!

@splendido
Copy link
Member

In case we're sure it's not a problem to configure the same route twice with flow-router, we can avoid checking whether the route is already set up (i.e. we could remove these lines).

@arunoda, do you think it would be a problem doing something like the following?

FlowRouter.route('/one/path', {
      name: 'myRoute',
      // Other options here...
});

FlowRouter.route('/another/path', {
      name: 'myRoute',  // same name as above!
      // Other different options here...
});

which is trying to change options (including path...) for a named route already defined.

@arunoda
Copy link

arunoda commented Jan 8, 2016

It won't be an issue for the route name. But configuring the same route definition twice will be problematic.

@splendido
Copy link
Member

@arunoda is there any way to undo or cancel a route definition so that a new call to FlowRouter.route could then be safely performed?

Edit: alternatively, is there any way to change the options for an already defined route?

@JulianKingman
Copy link

Thanks for the hack @raduchiriac, I ran into the same thing with telescope. Im interested to know if theres a superior solution.

@nicholasalanbrown
Copy link

Any updates on this? @raduchiriac 's hack did not work for me when trying to set a different layout for the '/sign-in' route.

@meshekhar
Copy link

I have the same issue, can't set a different layout to the signIn route. Any updates please? @raduchiriac

@Sureshkumar5694
Copy link

Sureshkumar5694 commented Dec 16, 2016

@raduchiriac
have you found any solution for this issue? If you have found any , pls share with us. i also need to set different layout for signUp in the AccountTemplates.

@raduchiriac
Copy link
Author

It's not a solution but a work-around.
It's more than a year ago so I don't remember everything but checking my answer above, I think I was doing this:

delete AccountsTemplates.routes.signUp;
AccountsTemplates.configureRoute('signUp', {
  name: 'signUp',
  path: '/sign-up',
  template: 'register'
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants