{"size": 576, "ext": "js", "max_stars_repo_path": "src/actions/kinds.js", "max_stars_repo_name": "breeders-zone/admin", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/actions/kinds.js", "max_issues_repo_name": "breeders-zone/admin", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/actions/kinds.js", "max_forks_repo_name": "breeders-zone/admin", "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": 22.1538461538, "max_line_length": 70, "alphanum_fraction": 0.5954861111}
import {DataService} from "../services";

const dataService = new DataService();

export const setKinds = (payload) => {
    return {
        type: 'SET_KINDS',
        payload
    }
};

export const deleteKind = (payload) => (dispatch, getState) => {
    const state = getState();
    const allKinds = state.kinds.all;
    const kindIdx = allKinds.findIndex((item) => item.id === payload);
    if (kindIdx >= 0) {
        allKinds.splice(kindIdx, 1);
    }

    dataService.deleteKind(payload);

    dispatch({
        type: 'DELETE_KIND',
        payload: allKinds
    })
};