Created
October 20, 2015 22:15
-
-
Save ksol/32fabbc6ad8aa8fbf068 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from "ember"; | |
import DS from "ember-data"; | |
export default DS.Model.extend({ | |
// Your ED relationships and properties here... | |
// ... | |
// Custom API | |
upvote() { | |
this.set('_updateEndpoint', 'upvote'); | |
let promise = this.save(); | |
promise.finally(() => this.set('_updateEndpoint', null)); | |
return promise; | |
}, | |
downvote() { | |
this.set('_updateEndpoint', 'downvote'); | |
let promise = this.save(); | |
promise.finally(() => this.set('_updateEndpoint', null)); | |
return promise; | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment