import React from 'react';

export const SET_COMMUNITY_DATA = 'SET_COMMUNITY_DATA';
export const SET_USERS_ACTIVITY_DATA = 'SET_USERS_ACTIVITY_DATA';
export const SET_EVENTS_LIST = 'SET_EVENTS_LIST';

export function setCommunityData() {
  const url = 'http://stats.loggingroads.org/';

  return function(dispatch) {
    $.get(url).then(function(communityData){
      dispatch({
        type: SET_COMMUNITY_DATA,
        communityData
      });
    })
  };
}

export function setUsersActivityData(data) {
  const url = 'http://stats.loggingroads.org/hashtags/logging-roads';
  return function(dispatch) {
    $.get(url).then(function(usersActivityData){
      dispatch({
        type:  SET_USERS_ACTIVITY_DATA,
        usersActivityData
      });
    })
  };

  // return {
  //   type: SET_USERS_ACTIVITY_DATA,
  //   usersActivityData: [
  //     {name: 'Pepi', roads: 33},
  //     {name: 'Pepi', roads: 33},
  //     {name: 'Pepi', roads: 33},
  //     {name: 'Pepi', roads: 33},
  //     {name: 'Pepi', roads: 33}
  //   ]
  // };
}


@@ -755,285 +755,8 @@
   %7D;
-%0A%0A  // return %7B%0A  //   type: SET_USERS_ACTIVITY_DATA,%0A  //   usersActivityData: %5B%0A  //     %7Bname: 'Pepi', roads: 33%7D,%0A  //     %7Bname: 'Pepi', roads: 33%7D,%0A  //     %7Bname: 'Pepi', roads: 33%7D,%0A  //     %7Bname: 'Pepi', roads: 33%7D,%0A  //     %7Bname: 'Pepi', roads: 33%7D%0A  //   %5D%0A  // %7D;
 %0A%7D%0A%0A

delete spare code