vendredi 1 mai 2015

Setting up UserApp.io on ember-cli

This may seem trivial, but I have been unsuccessful at getting this to work. I have used UserApp.io successfully for user/authentication management. I recently created an ember app using ember-cli, but I am unable to get the two to work together despite ember being supported by UserApp.io. Here are there instructions (integrating with ember without cli).

http://ift.tt/1HYOGuo

Here is a snippet:

Include the UserApp JavaScript library and this Ember module in your index.html. Be sure to add them before your app.js file.

<script src="http://ift.tt/1tqZ3N5"></script>
<script src="http://ift.tt/1HYOGur"></script>

(You can also install the module with bower: $ bower install userapp-ember)

Initiate the module

Add this code above App = Ember.Application.create(); in app.js with your App Id.

Ember.Application.initializer({
    name: 'userapp',
    initialize: function(container, application) {
        Ember.UserApp.setup(application, { appId: 'YOUR-USERAPP-APP-ID' });
    }
});

Because I am using ember-cli I have created a file called userapp.js in an initializers folder which has the following code:

import Ember from 'ember';

export default {
    name: 'userapp',
    initialize: function(container, application) {
        Ember.UserApp.setup(application, { 
            appId: 'USERAPP-ID-INSERTED-HERE',
            loginRoute: 'login',
            indexRoute: 'index',
            heartbeatInterval: 20000,
            usernameIsEmail: false
        });
    }
};

When I run my app I get the following error:

Uncaught TypeError: Cannot read property 'setup' of undefined

I feel like this is something simple/stupid, but for the life of me I cannot figure this one out.




Aucun commentaire:

Enregistrer un commentaire