From 2b49a0947599c0380f2adccfdc632e6f2edcb2cb Mon Sep 17 00:00:00 2001 From: igoradamenko Date: Sat, 19 May 2018 00:07:57 +0300 Subject: [PATCH] add proxy methods for store --- web/app/components/root/root.jsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/web/app/components/root/root.jsx b/web/app/components/root/root.jsx index 6a2b2865..12543a96 100644 --- a/web/app/components/root/root.jsx +++ b/web/app/components/root/root.jsx @@ -33,6 +33,8 @@ export default class Root extends Component { sort, }; + this.addComment = this.addComment.bind(this); + this.replaceComment = this.replaceComment.bind(this); this.onSignIn = this.onSignIn.bind(this); this.onSignOut = this.onSignOut.bind(this); this.onBlockedUsersShow = this.onBlockedUsersShow.bind(this); @@ -156,6 +158,14 @@ export default class Root extends Component { this.setState({ wasSomeoneUnblocked: true }); } + addComment(comment) { + store.addComment(comment); + } + + replaceComment(comment) { + store.replaceComment(comment); + } + render({}, { config = {}, comments = [], user, sort, isLoaded, isBlockedVisible, isCommentsListLoading, bannedUsers }) { if (!isLoaded) { return ( @@ -193,7 +203,7 @@ export default class Root extends Component { ) } @@ -223,8 +233,8 @@ export default class Root extends Component { mix="root__thread" mods={{ level: 0 }} data={thread} - onReply={store.addComment} - onEdit={store.replaceComment} + onReply={this.addComment} + onEdit={this.replaceComment} /> )) }