From 07f0df6af428a56a4abedde841a0813e2802cd2b Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Wed, 2 Dec 2015 09:21:58 -0500
Subject: Moved action creation for suggestions

---
 web/react/utils/async_client.jsx | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

(limited to 'web/react/utils/async_client.jsx')

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');
+        }
+    );
+}
-- 
cgit v1.2.3-1-g7c22

