import _ from "lodash";
import { LOAD_FOLLOWERS, ADD_FOLLOWER, REMOVE_FOLLOWER } from "./types";
import { followerActions } from "../apis/followerActions";
export const loadFollowers = followers => {
  return {
    type: LOAD_FOLLOWERS,
    payload: followers
  };
};
export const getFollowers = userId => {
  return async dispatch => {
    followerActions.getFollowing(userId).then(res => {
      // console.log('getFollowing', res.data);
      if (res.data != null && res.data.Items != null && !_.isEmpty(res.data.Items)) {
        dispatch(loadFollowers(res.data.Items));
      }
    }).catch(error => {
      console.log("getFollowing", error);
    });
  };
};
export const addFollower = user => {
  return {
    type: ADD_FOLLOWER,
    payload: user
  };
};
export const removeFollower = userId => {
  return {
    type: REMOVE_FOLLOWER,
    payload: userId
  };
};
//# sourceMappingURL=FollowerActions.js.map