ember.js - Ember-Simple-Auth: Overloading sessionAuthenticationSucceeded -
ember.js - Ember-Simple-Auth: Overloading sessionAuthenticationSucceeded -
i trying override sessionauthenticationsucceeded
in ember.simpleauth.applicationroutemixin
class, can transition routeafterauthentication
model passed in.
basically this.transitionto(configuration.routeafterauthentication, model);
, after doing ember.simpleauth.applicationroutemixin.reopen()
override of function never called. going wrong? can mixins not reopened in fashion? or should passing model routeafterauthentication
transition in different fashion.
edit: stupid reputation limits, gonna reply myself apparently have wait 8 hours, here reply now:
well, not exclusively sure if right way this, works. looking through example: custom-server , wound doing accomplish wanted.
var applicationroute = container.lookup('route:application'); var session = container.lookup('ember-simple-auth-session:main'); var store = container.lookup('store:main'); session.on('sessionauthenticationsucceeded', function() { var user = store.find('user', session.get('user_id')); container.lookup('controller:application').set('content', user) applicationroute.transitionto('profile.resume', user); });
the easiest solution define sessionauthenticationsucceeded
on application route instead of reopening mixins:
/// routes/application.js import applicationroutemixin 'simple-auth/mixins/application-route-mixin'; export default ember.route.extend(applicationroutemixin, { actions: { sessionauthenticationsucceeded: function() { … } } })
ember.js ember-simple-auth
Comments
Post a Comment