vendredi 9 septembre 2016

Request to third party API in an Ember route's model hook

I have a need to request some data from a third party API endpoint in an Ember app (Using Ember 1.7)

I'm not sure the best way to handle the response, should I:

  • Use $.ajax in my model hook, return the raw data and not worry about Ember models?

  • Use $.ajax in my model hook, use store.createRecord to map the returned data into models and use store.all to return this data to my component.

  • Use an adapter and use store.findAll to get the data (could be tricky as the returned data won't match my models).

I'm not quite sure of the pros and con's of getting data in this way, any input would be great.




Aucun commentaire:

Enregistrer un commentaire