From 20f581f79669118a1a4052408078d53c7bbe83f2 Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Sat, 15 Oct 2016 12:06:30 +0200
Subject: Display follow suggestions

---
 .../javascripts/components/actions/suggestions.jsx | 26 ++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

(limited to 'app/assets/javascripts/components/actions/suggestions.jsx')

diff --git a/app/assets/javascripts/components/actions/suggestions.jsx b/app/assets/javascripts/components/actions/suggestions.jsx
index 562a901c5..c70a4d121 100644
--- a/app/assets/javascripts/components/actions/suggestions.jsx
+++ b/app/assets/javascripts/components/actions/suggestions.jsx
@@ -6,10 +6,32 @@ export const SUGGESTIONS_FETCH_FAIL    = 'SUGGESTIONS_FETCH_FAIL';
 
 export function fetchSuggestions() {
   return (dispatch, getState) => {
+    dispatch(fetchSuggestionsRequest());
+
     api(getState).get('/api/v1/accounts/suggestions').then(response => {
-      console.log(response.data);
+      dispatch(fetchSuggestionsSuccess(response.data));
     }).catch(error => {
-      console.error(error);
+      dispatch(fetchSuggestionsFail(error));
     });
   };
 };
+
+export function fetchSuggestionsRequest() {
+  return {
+    type: SUGGESTIONS_FETCH_REQUEST
+  };
+};
+
+export function fetchSuggestionsSuccess(suggestions) {
+  return {
+    type: SUGGESTIONS_FETCH_SUCCESS,
+    suggestions: suggestions
+  };
+};
+
+export function fetchSuggestionsFail(error) {
+  return {
+    type: SUGGESTIONS_FETCH_FAIL,
+    error: error
+  };
+};
-- 
cgit 

