0

Session is working and no errors are being displayed, but none of the routeMixins are working... I've seem some similar issues and their solutions, but somehow they do not fix mine (or I misunderstood their implementation.) Here is my current Application router:

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

export default Ember.Route.extend
({
    ApplicationRouteMixin,
    model: function()
    {
        return Ember.Object.create
        ({
            genres: this.store.findAll('genre'),
            factTypes: this.store.findAll('factType'),
            categories: this.store.findAll('category')
        });
    },
    setupController: function(controller, models)
    {
        this._super(controller, models);
    }
});

I also tried the following without any success:

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

and

model: function(transition, queryParams)
{
    this._super(transition, queryParams);
    return Ember.Object.create
    ({
        genres: this.store.findAll('genre'),
        factTypes: this.store.findAll('factType'),
        categories: this.store.findAll('category')
    });
}

Some of the routeMixins that I am using on my application:

User.edit

import Ember from 'ember';
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend(AuthenticatedRouteMixin);

Login route

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

export default Ember.Route.extend
({
    UnauthenticatedRouteMixin,
    setupController: function(controller)
    {
        controller.set('errorMessage', null);
    }
});
Deovandski
  • 790
  • 1
  • 8
  • 22

1 Answers1

0

Once again I missed the details... The answer for this specific problem is to move the RouteMixins to before the export default opening bracket as seen below:

Application Route

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

export default Ember.Route.extend
(ApplicationRouteMixin, {
    model: function()
    {
        return Ember.Object.create
        ({
            genres: this.store.findAll('genre'),
            factTypes: this.store.findAll('factType'),
            categories: this.store.findAll('category')
        });
    }
});

Login Route

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

export default Ember.Route.extend
(UnauthenticatedRouteMixin,{
    setupController: function(controller)
    {
        controller.set('errorMessage', null);
    }
});

I should have deleted the question, but you never know if someone else also makes the same mistake and have a hard time detecting it... You can see the docs here

Deovandski
  • 790
  • 1
  • 8
  • 22
  • This is mostly because your parenthesis style is pretty bad. Take a look at a Javascript style guide for help improving it. – Interrobang Aug 19 '15 at 00:49
  • I've always preferred C# layout coding conventions over any other language, and the fact that this was a solo project, I did not bother to see into them. However, now that I started participating on this community and the code is open source, I will make the switch to the JavaScript conventions. – Deovandski Aug 19 '15 at 05:13