about summary refs log tree commit diff
path: root/app/assets/javascripts/components/actions
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-10-15 12:06:30 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-10-15 12:06:30 +0200
commit20f581f79669118a1a4052408078d53c7bbe83f2 (patch)
tree4fa86d90bdb0b92ce300b95fa9f3661d16b154b7 /app/assets/javascripts/components/actions
parente21a3fe0cd91dfeae76bce4d58c7611e78b60fbf (diff)
Display follow suggestions
Diffstat (limited to 'app/assets/javascripts/components/actions')
-rw-r--r--app/assets/javascripts/components/actions/suggestions.jsx26
1 files changed, 24 insertions, 2 deletions
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
+  };
+};