balafi
balafi

Reputation: 2153

AuthenticatedRouteMixin: No redirection when route hooks are overridden

Authentication seems to be skipped if I define beforeModel hook in my index route. Maybe this overrides the mixin's beforeModel...

Example: the following does not redirect me to /login until I remove 'beforeModel' from my route. The same for 'afterModel' and possibly other hooks

// app/routes/index.js
import Ember from 'ember';
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';

export default Ember.Route.extend(AuthenticatedRouteMixin,{
 beforeModel : function(){
    // empty function
  }
});

any help would be appreciated. What I want to do is simple transitions from route to route. Eg. go to /users/userlist when the URL is simple /users

Upvotes: 1

Views: 791

Answers (1)

marcoow
marcoow

Reputation: 4062

This overrides the mixin's implementation as you already suggested. You need to call this._super(transition);:

beforeModel: function(transition, queryParams) {
  this._super(transition, queryParams);
  …
}

Upvotes: 3

Related Questions