简体   繁体   中英

Ember transition retry with query params

So I have application authentication logic in my ember app. When the user hits a route that they need to be authenticated to enter, they are transitioned to the Login route and the original route they wanted to hit is saved. When they login, I check to see if there was an original route to transition back to and send them back to that at that point.

This works fine, except when there are query params in the original route. The transition should send them to '#/OldRoute/3' (for example), but instead it sends them to '#/OldRoute/undefined'

How can I retry a transition while maintaining the query params?

I think you would need proper model to redirect to nested route, so lets see, may be you can save the route and the parameter(X) too. Once you have authenticated the user, you might want to fetch the model(ticket model with id X) from the store based on the route name (original route) and then only do transition with the fetched model passed as parameter to transitionToRoute function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM