vendredi 16 septembre 2016

init and sessionAuthenticated in ApplicationRouteMixin can not be together

I lost my head for this problem: init and sessionAuthenticated in ApplicationRouteMixin can not be together!

In my routes/application.js I have something like this:

import Ember from 'ember';
import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin';
import other from '../other';

export default Ember.Route.extend(ApplicationRouteMixin, {

init: function () {
    otherJsImImportingMainFunction();
},

sessionAuthenticated() {
    this.transitionTo('someRoute');
    debugger;
}

actions: {
    ...
}

};

In this situation my code doesn't work.

I authenticate and then sessionAuthenticated() is never called.

If I comment out "init:" it works good.

How to fix this?

I'm doing well importing this way?




Aucun commentaire:

Enregistrer un commentaire