My ember application use 1.11.3 version and ember-simple-auth(0.7.3). All of route must set the AuthenticatedRouteMixin and get the account infomation use beforeModel, I think is not good way to do this. Example:
App.Route = Ember.Route.extend(AuthenticatedRouteMixin, {
beforeModel: function() {
Account.find().then(function(user) {
this.set('user', user);
})
},
setupController: function(controller, model) {
controller.set('model', model);
controller.set('user', this.get('user'));
}
});
App.ApplicationRoute = App.Route.extend();
I set a jsbin: http://ift.tt/1B4CZlA
If my all route use App.Route.extend();, it is has problem is AuthenticatedRouteMixin can not work.
I use Route.extent set all to route beforeModel to get the account infomations is a good way?
Maybe there is any better way to approach this problem?
Aucun commentaire:
Enregistrer un commentaire