travis-web/app/routes/accounts/index.js
2016-01-04 13:15:14 +01:00

16 lines
539 B
JavaScript

import TravisRoute from 'travis/routes/basic';
export default TravisRoute.extend({
redirect: function() {
// TODO: setting accounts model in ProfileRoute is wrong, but
// at this stage it's better than what we had before
var account, accounts, login;
accounts = this.modelFor('accounts');
login = this.controllerFor('currentUser').get('model.login');
account = accounts.find(function(account) {
return account.get('login') === login;
});
return this.transitionTo('account', account);
}
});