{"size": 841, "ext": "js", "max_stars_repo_path": "frontend/src/actions/keywordAnalysis.js", "max_stars_repo_name": "gpiechnik2/senter", "max_stars_repo_stars_event_min_datetime": "2021-12-08T19:38:33.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-26T15:02:57.000Z", "max_issues_repo_path": "frontend/src/actions/keywordAnalysis.js", "max_issues_repo_name": "gpiechnik2/senter", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "frontend/src/actions/keywordAnalysis.js", "max_forks_repo_name": "gpiechnik2/senter", "max_forks_repo_forks_event_min_datetime": "2021-12-08T19:38:39.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-08T19:38:39.000Z"}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 22.1315789474, "max_line_length": 69, "alphanum_fraction": 0.6373365042}
import * as api from '../api';
import {
  REQUEST_KEYWORDANALYSIS_DATA,
  RECEIVE_KEYWORDANALYSIS_DATA,
  CLEAR_KEYWORDANALYSIS_DATA,
} from '../constants/actionTypes';

export const getkeywordanalysis = (formData) => async (dispatch) => {
  dispatch({
    type: CLEAR_KEYWORDANALYSIS_DATA,
  });
  dispatch({
    type: REQUEST_KEYWORDANALYSIS_DATA,
  });
  try {
    const { data } = await api.getKeywordAnalysis(formData);

    dispatch({
      type: RECEIVE_KEYWORDANALYSIS_DATA,
      keywordAnalysisData: data,
      isError: false,
      errorMsg: '',
    });
  } catch (error) {
    dispatch({
      type: RECEIVE_KEYWORDANALYSIS_DATA,
      keywordAnalysisData: null,
      isError: true,
      errorMsg: error,
    });
    setTimeout(() => {
      dispatch({
        type: CLEAR_KEYWORDANALYSIS_DATA,
      });
    }, 3200);
  }
};
