add proxy methods for store

This commit is contained in:
igoradamenko
2018-05-19 00:07:57 +03:00
parent b43f9cbb23
commit 2b49a09475
+13 -3
View File
@@ -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 {
<Input
mix="root__input"
mods={{ type: 'main' }}
onSubmit={store.addComment}
onSubmit={this.addComment}
/>
)
}
@@ -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}
/>
))
}