I am trying to use _super in the Promise handler inside the Controller action, but it does not work because it seems to lose the correct chain of functions.
ApplicationRoute = Ember.Route.extend SimpleAuth.ApplicationRouteMixin, actions: sessionAuthenticationSucceeded: -> @get("session.user").then (user) => if @get("session.isTemporaryPassword") or not user.get "lastLogin" @transitionTo "temp-password" else @_super()
I want to return to Mixin's default behavior in else , but I need to allow user asynchronously before I can make a conditional statement. I tried:
ApplicationRoute = Ember.Route.extend SimpleAuth.ApplicationRouteMixin, actions: sessionAuthenticationSucceeded: -> _super = @_super @get("session.user").then (user) => if @get("session.isTemporaryPassword") or not user.get "lastLogin" @transitionTo "temp-password" else _super()
and
ApplicationRoute = Ember.Route.extend SimpleAuth.ApplicationRouteMixin, actions: sessionAuthenticationSucceeded: -> @get("session.user").then (user) => if @get("session.isTemporaryPassword") or not user.get "lastLogin" @transitionTo "temp-password" else @_super.bind(@)()
Nothing works.
This answer claimed that this should work with 1.5.0, but I am using 1.7.0-beta.5 and it does not go. Is there a way to make this work, even in terms of approaching it differently?
source share