lundi 22 mai 2017

Where to put ajax request in Ember tutorial app?

I want to add "Weather: 24C" to the rental-listing component of the super-rentals tutorial app.

Where would be the "best-practices" place to put this ajax request?

Ember.$.getJSON(`http://ift.tt/2q0POYU}`)
    .then(function(json) {
      return JSON.parse(json).main.temp;
  });

Do I need to add a component, add a model, add a service, add a second adapter, modify the existing adapter? Something else? All of these? Is the problem that the tutorial uses Mirage? I ask this because when I think I'm getting close, I get an error like this:

Mirage: Your Ember app tried to GET
'http://ift.tt/2qvZjTP',
     but there was no route defined to handle this request.
     Define a route that matches this path in your
     mirage/config.js file. Did you forget to add your namespace?




Aucun commentaire:

Enregistrer un commentaire