Skip to content

Instantly share code, notes, and snippets.

View nordfjord's full-sized avatar

Einar Norðfjörð nordfjord

View GitHub Profile
@nordfjord
nordfjord / comment-model.js
Last active November 9, 2015 18:58 — forked from gilbert/comment-model.js
Mithril-friendly Model Layer
var Comment = {}
Comment.store = Store('Comment', {idprop: 'id'});
Comment.fetchForPost = function (postId) {
return m.request({ method: 'GET', url: '/api/post/' + postId + '/comments' })
.then(Comment.store.syncAll)
}