diff options
author | Carlos Tadeu Panato Junior <ctadeu@gmail.com> | 2017-01-27 11:39:13 +0100 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2017-01-27 10:39:13 +0000 |
commit | d72547433af3ec5829ce0de4f4e1cfd440be7142 (patch) | |
tree | 6bd7664e9058468842c7b7bb7c7a76abf1b7c5e3 /webapp/actions/post_actions.jsx | |
parent | 49c677f6b46409289210abc0e0bda63735be3e9f (diff) | |
download | chat-d72547433af3ec5829ce0de4f4e1cfd440be7142.tar.gz chat-d72547433af3ec5829ce0de4f4e1cfd440be7142.tar.bz2 chat-d72547433af3ec5829ce0de4f4e1cfd440be7142.zip |
Move remaining client functions in components to actions (#5171)
Diffstat (limited to 'webapp/actions/post_actions.jsx')
-rw-r--r-- | webapp/actions/post_actions.jsx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/webapp/actions/post_actions.jsx b/webapp/actions/post_actions.jsx index 3f660b94d..61f193b66 100644 --- a/webapp/actions/post_actions.jsx +++ b/webapp/actions/post_actions.jsx @@ -417,3 +417,30 @@ export function deletePost(channelId, post, success, error) { } ); } + +export function performSearch(terms, isMentionSearch, success, error) { + Client.search( + terms, + isMentionSearch, + (data) => { + AppDispatcher.handleServerAction({ + type: ActionTypes.RECEIVED_SEARCH, + results: data, + is_mention_search: isMentionSearch + }); + + loadProfilesForPosts(data.posts); + + if (success) { + success(data); + } + }, + (err) => { + AsyncClient.dispatchError(err, 'search'); + + if (error) { + error(err); + } + } + ); +} |