<commit_before>import request from 'superagent';
export const ASYNC_CALL_STARTED = 'ASYNC_CALL_STARTED';
export const POST_REQUEST = 'POST_REQUEST';

function asyncStarted() {
  return {
    type: ASYNC_CALL_STARTED
  };
}

export function postRequest(url, data, headers = {}) {
  return (dispatch, getStore) => {
    dispatch(asyncStarted());

    request.post(url).send(data)
    .set(headers)
    .end((err, res) => {
      if (err) {
        console.log(err);
      }

      console.log(res);
    });
  }
}<commit_msg>pass success and error actions to postRequest thunk<commit_after>import request from 'superagent';
export const ASYNC_CALL_STARTED = 'ASYNC_CALL_STARTED';
export const POST_REQUEST = 'POST_REQUEST';

function asyncStarted() {
  return {
    type: ASYNC_CALL_STARTED
  };
}

export function postRequest(url, data, headers = {}, successAction, errorAction) {
  return (dispatch, getStore) => {
    dispatch(asyncStarted());

    request.post(url).send(data)
    .set(headers)
    .end((err, res) => {
      if (err) {
        dispatch(errorAction(data));
      }

      dispatch(successAction(data));
    });
  }
}
{'fraction_non_alphanumeric': 0.13580246913580246, 'fraction_numerical': 0.0, 'mean_word_length': 3.613821138211382, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1548312', 'n_tokens_mistral': 372, 'n_tokens_neox': 369, 'n_words': 77}