mercredi 1 juin 2016

Create a new method on the store?

Me and my colleague is building an application that has two different api-endpoints which it talks to. Unfortunately it sometimes needs to do multiple requests to both the endpoints and mash the answer together into one big data structure.

So far, we have done it by overriding the query-method in the ApplicationAdapter but has encountered an issue with this since we sometimes require just a single request to be made.

We now want to be able to add a new method to the store so instead of:

this.get('store').query(somemodel, params);

We want to be able to do:

this.get('store').multipleQuery(somemodel, params);

In the adapter, creating a new method is easy as we can simply just add it. But how do we create a new method on the store and how can we make sure the Adapter uses our extended class?

Thanks in advance




Aucun commentaire:

Enregistrer un commentaire