Skip to content

Instantly share code, notes, and snippets.

@bmx269
Created July 6, 2017 05:30
Show Gist options
  • Save bmx269/62130c6aa7cb04b80811dc1ccf819173 to your computer and use it in GitHub Desktop.
Save bmx269/62130c6aa7cb04b80811dc1ccf819173 to your computer and use it in GitHub Desktop.
saveVote: task(function * () {
var queueVotes = this.get('voteItems').map(item => {
item.set('isSelected', false);
let itemId = item.get('id');
let itemTitle = item.get('title');
let itemImage = item.get('fieldImage.url');
let currentCampaign = this.get('campaign.id');
let newVote= this.store.createRecord('node--vote', {
title: itemTitle,
fieldItemid: itemId,
fieldCampaignid: currentCampaign,
fieldImageUrl: itemImage
});
});
yield queueVotes.save()
yield timeout(DEBOUNCE_TIMEOUT);
return {};
}).enqueue().maxConcurrency(1),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment