fix submission

This commit is contained in:
Leo Horie 2016-05-04 13:45:42 -04:00
parent 965f700cc4
commit d61a6169ea

View file

@ -71,11 +71,11 @@ function showReplying(vnode) {
return false return false
} }
function submitComment(node) { function submitComment(vnode) {
api.newComment(node.newComment, node.id).then(function(response) { api.newComment(vnode.state.newComment, vnode.attrs.node.id).then(function(response) {
node.newComment = "" vnode.state.newComment = ""
node.replying = false vnode.state.replying = false
node.children.push(response.data) vnode.attrs.node.children.push(response.data)
}) })
.then(run) .then(run)
return false return false
@ -163,7 +163,7 @@ var ThreadNode = {
var Reply = { var Reply = {
view: function(vnode) { view: function(vnode) {
return vnode.state.replying return vnode.state.replying
? m("form", {onsubmit: function() {return submitComment(vnode.attrs.node)}}, [ ? m("form", {onsubmit: function() {return submitComment(vnode)}}, [
m("textarea", { m("textarea", {
value: vnode.state.newComment, value: vnode.state.newComment,
oninput: function(e) { oninput: function(e) {