mardi 19 septembre 2017

How to use adapter in an ember-engines

as the title say, I have some problem understanding how to use an adapter in an ember-engines.
I am currently running my application with ember@2.15, ember-data@2.15 and ember-engines@0.5.14. I already used an adapter in my main application, but if I tried to reproduce a basic adapter in my application, the page is loading indefinitely.
In my route, I call my adapter with the findAll method:

  model()
    {
        "use strict";
         console.log('In my route');
         return this.get('store').findAll('my-adapter-name', {reload: true});
    }

And in my adapter, I respect the syntaxe that I used in my in-app adapter:

import DS from 'ember-data';
import Ember from 'ember';

export default DS.Adapter.extend({

    findAll: function (store, type, sinceToken, snapshotRecordArray)
    {
        console.log("In my adapter");
        return new Ember.RSVP.Promise(function (resolve, reject)
        {
        // I accede to my websocket service here, nothing to do with my question
        });
    },
    /* *
    * My other function, like findRecord, ect...
    */
});

As you can see, I putted some console.log in my code, and I can access to the message in my route, which is in my engine, but I can't access to the message in my adapter, which is also in my engine.
I tried to put a console.log in an adapter in my applicaton, and the message is properly shown, so I am sure this is because I can't access to the adapter in my engine, so if anybody has an idea to how we should configure our adapter in our ember-engines, this would be very appreciated.
For your information, this is an in-repo engines.




Aucun commentaire:

Enregistrer un commentaire