Display follow suggestions

This commit is contained in:
Eugen Rochko
2016-10-15 12:06:30 +02:00
parent e21a3fe0cd
commit 20f581f796
8 changed files with 146 additions and 6 deletions

View File

@ -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
};
};