mercredi 21 janvier 2015

Custom store action inside ApplicationStore

Brief:


I'm writing an app that is consuming a non-standard REST API and I want to consume an endpoint which is supposed to fetch live data of a Model my problem is that I would have to either write a $.JSON on the route and push to the Model or add an "action" to the store which is what I'm leaning towards.


Complete:


I have a Model called "Mission" that is already configured to fetch all or by id from API ( had to write custom adapter and serializer ).


I have a route called Index that is trying to define its model by doing the following:



Droneshare.IndexRoute = Ember.Route.extend({
model: function() {
return this.store.live('mission');
}
});


And the contents never get to the controller, but I can see the XHR was made and that missions where loaded on the inspector (see attached images)


http call to fetch live missions missions inside the Ember extension


Here is the source I'm working with, it's not the complete project only the relevant parts: http://ift.tt/1EtQOH3


Question 1: What am I missing from my custom action to get this to work?


Question 2: Is there a way to not have to redeclare the private functions from store.js inside ember? (this ones specifically)


Question 3: Would there be another way of doing this?





Aucun commentaire:

Enregistrer un commentaire