From d72547433af3ec5829ce0de4f4e1cfd440be7142 Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Fri, 27 Jan 2017 11:39:13 +0100 Subject: Move remaining client functions in components to actions (#5171) --- webapp/actions/post_actions.jsx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'webapp/actions/post_actions.jsx') 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); + } + } + ); +} -- cgit v1.2.3-1-g7c22