2

How do you override the routeIfAlreadyAuthenticated?

And once that happens, how can it transition to a route with a dynamic segment?

I realize I can override sessionAuthenticated; and in that ways override the functionality of routeAfterAuthentication. However, routeIfAlreadyAuthenticated is a computed property that is executed in a beforeModel in the unauthenticated-route-mixin.js mixin.

Any help would be greatly appreciated.

Stéphane Bruckert
  • 21,706
  • 14
  • 92
  • 130
user2517182
  • 1,241
  • 3
  • 15
  • 37

1 Answers1

2

In app/session/route.js, just do:

import Ember from 'ember';
import UnauthenticatedRouteMixin from 'ember-simple-auth/mixins/unauthenticated-route-mixin';

export default Ember.Route.extend(UnauthenticatedRouteMixin, {
  routeIfAlreadyAuthenticated: 'dashboard'
});

and it works, no more:

Error while processing route: session.login Assertion Failed: The route index was not found Error


The following works as well, but is deprecated

In config/environment.js:

var ENV = {
   ...
};

ENV['ember-simple-auth'] = {
   // authenticationRoute:          'login',
   // routeAfterAuthentication:     'dashboard',
   routeIfAlreadyAuthenticated:  'dashboard'
};
Stéphane Bruckert
  • 21,706
  • 14
  • 92
  • 130
  • For details on available options, see the API docs: http://ember-simple-auth.com/api/classes/Configuration.html – abought May 11 '17 at 13:28
  • I don't even remember why I wrote this question. lol. However, if you mention there is not an certain error that does not come up anymore I am assuming there was an update that addressed whatever it was I was concerned about. Thanks. – user2517182 May 12 '17 at 16:05