-
Notifications
You must be signed in to change notification settings - Fork 601
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
401 in application route's model is not caught properly #199
Comments
Why do you unsubscribe from the session events in the |
Well, the activate will re-subscribe, this is just the monkeypatching I needed to do. So, in beforeModel make sure to subscribe to events and trigger them on the transition object, and then once we are done transitioning, in the activate method we then want to trigger the events on the route itself. So there would be this flow:
I am not sure if there is a better approach, I dislike the fact that the listeners need to be torn down. It would be useful if we could have it just trigger where it triggers events based on if the transition is complete. Is there a state that we can check for this? |
Not sure how to handle this best. The best solution is to have the event -> action translation hooked up in an initializer I think. The idea behind doing this in the mixing is simply that you can "opt-in" into that forwarding of session events to route actions only by including that mixing. |
I'm now setting up the event listeners in the mixin's |
I have not ran the test directly, but while a transition is taking place events cannot be sent on the router itself, they must be sent on the transition object. Let me see if I can hook up a test to show the issue. |
That's what I expected as well but surprisingly it worked for me. |
Nevermind - it does not work. |
I think the best solution would be to somehow use the transition object passed into the |
I have an application route which has the logic:
In the scenario where the fetch of
app
returns a 401 theauthorizationFailed
event get's fired but the action never gets called. This is because the listeners are setup in theactivate
method which is not called until after themodel
method get's called. One workaround is to define the listeners in thebeforeModel
call that will trigger the error on thetransition
parameter passed in. And then on theactivate
method to turn off those listeners.My working code that handles this scenario, apologies for the coffeescript.
The text was updated successfully, but these errors were encountered: