diff options
author | hmhealey <harrisonmhealey@gmail.com> | 2015-12-02 09:21:58 -0500 |
---|---|---|
committer | hmhealey <harrisonmhealey@gmail.com> | 2015-12-02 09:21:58 -0500 |
commit | 07f0df6af428a56a4abedde841a0813e2802cd2b (patch) | |
tree | 7f2b7e913ac91ed6ee1bacaa0831c37b71c549d8 /web/react/utils/async_client.jsx | |
parent | 06e0919bca7ee4280c6eed58838ca2be10e7b4fb (diff) | |
download | chat-07f0df6af428a56a4abedde841a0813e2802cd2b.tar.gz chat-07f0df6af428a56a4abedde841a0813e2802cd2b.tar.bz2 chat-07f0df6af428a56a4abedde841a0813e2802cd2b.zip |
Moved action creation for suggestions
Diffstat (limited to 'web/react/utils/async_client.jsx')
-rw-r--r-- | web/react/utils/async_client.jsx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx index 8cf111d55..edd26b4d1 100644 --- a/web/react/utils/async_client.jsx +++ b/web/react/utils/async_client.jsx @@ -731,3 +731,27 @@ export function savePreferences(preferences, success, error) { } ); } + +export function getSuggestedCommands(command, suggestionId, component) { + client.executeCommand( + '', + command, + true, + (data) => { + // pull out the suggested commands from the returned data + const terms = data.suggestions.map((suggestion) => suggestion.suggestion); + + AppDispatcher.handleServerAction({ + type: ActionTypes.SUGGESTION_RECEIVED_SUGGESTIONS, + id: suggestionId, + matchedPretext: command, + terms, + items: data.suggestions, + component + }); + }, + (err) => { + dispatchError(err, 'getCommandSuggestions'); + } + ); +} |