Skip to content

Instantly share code, notes, and snippets.

@JackLaBarba
Created April 23, 2015 22:55
Show Gist options
  • Save JackLaBarba/c1b3ad311340021b461f to your computer and use it in GitHub Desktop.
Save JackLaBarba/c1b3ad311340021b461f to your computer and use it in GitHub Desktop.
Ember.$ + pushPayload
fetchImages: function() {
var modelURL = this.store.adapterFor('collection-item').buildURL('collection-item', this.get('id'));
var promise = new Ember.RSVP.Promise((resolve, reject) => {
Ember.$.post(`${modelURL}/scrape_images`).then((payload) => {
Ember.run(() => this.store.pushPayload('collection-item', payload));
resolve(this);
}, reject);
});
return this.isLoadingWhile(promise);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment