Created
August 13, 2016 04:49
-
-
Save kulakowka/1ebcedae6025971e6087a6224e6074c4 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
var prop = (prop) => (obj) => obj[prop] | |
var html = (selector) => (data) => $(selector).html(data) | |
var render = (template) => (json) => Template.render(template, json) | |
var comments = (params) => fetch('/comments', params).then(JSON.parse).then(prop('data')).then(render('commentsList')) | |
var renderComments = (params) => comments(params).then(html('.comments')) | |
renderComments({ user: 1 }).catch(err => console.error(err)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment