{"size": 924, "ext": "js", "max_stars_repo_path": "src/Actions/EarthQuakeActions.js", "max_stars_repo_name": "girishparameswar/Earth-Quakes-Reporter-using-React-Redux-thunk", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Actions/EarthQuakeActions.js", "max_issues_repo_name": "girishparameswar/Earth-Quakes-Reporter-using-React-Redux-thunk", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Actions/EarthQuakeActions.js", "max_forks_repo_name": "girishparameswar/Earth-Quakes-Reporter-using-React-Redux-thunk", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.875, "max_line_length": 74, "alphanum_fraction": 0.5075757576}
export function fetching_earthquakes() {
    return { type: "FETCHING_EARTHQUAKES", info: { fetching: true } }
}


export function fetching_success(data) {
    return (dispatch) => {
        dispatch({ type: "FETCHING_SUCCESS", info: { fetching: false } });
        dispatch(get_earthquakes(data));
    }
}

export function get_earthquakes(data) {
    return { type: 'GET_EARTHQUAKES', info: data }
}

export function  earthquakes(earthquakeUrl){
        return (dispatch) => {
            dispatch(fetching_earthquakes());
            return fetch(earthquakeUrl)
                    .then((data) =>{
                        return data.json()
                    })
                    .then((dataJson) =>{
                        dispatch(fetching_success(dataJson))
                    })
                    .catch((err) =>{
                        console.log("Error Ocuured" +err);
                    });
        }
}
