<commit_before>import * as types from './actionTypes';
import GithubAPI from '../api/githubAPI';

export function oauthTempCodeReceived(tempCode) {
    return {type: types.OAUTH_TEMP_CODE_RECEIVED, tempCode};
}

export function oauthTokenReceived(token) {
  return {type: types.OAUTH_TOKEN_RECEIVED, token};
}

export function oauthTokenDestroyed() {
  return {type: types.OAUTH_TOKEN_DESTROYED};
}

export function oauthAuthUserLoaded(user) {
  return {type: types.OAUTH_AUTH_USER_LOADED, user};
}


export function storeOAuthTempCode(tempCode) {
  return function (dispatch){
    dispatch(oauthTempCodeReceived(tempCode));
  };
}

export function storeOAuthToken(token) {
  return function (dispatch){
    dispatch(oauthTokenReceived(token));
  };
}

export function destroyOAuthToken() {
  return function (dispatch){
    dispatch(oauthTokenDestroyed());
  };<commit_msg>Make destroyOAuthToken action destroy & recreate Octokat instance<commit_after>import * as types from './actionTypes';
import GithubAPI from '../api/githubAPI';

export function oauthTempCodeReceived(tempCode) {
    return {type: types.OAUTH_TEMP_CODE_RECEIVED, tempCode};
}

export function oauthTokenReceived(token) {
  return {type: types.OAUTH_TOKEN_RECEIVED, token};
}

export function oauthTokenDestroyed() {
  return {type: types.OAUTH_TOKEN_DESTROYED};
}

export function oauthAuthUserLoaded(user) {
  return {type: types.OAUTH_AUTH_USER_LOADED, user};
}


export function storeOAuthTempCode(tempCode) {
  return function (dispatch){
    dispatch(oauthTempCodeReceived(tempCode));
  };
}

export function storeOAuthToken(token) {
  return function (dispatch){
    dispatch(oauthTokenReceived(token));
  };
}

export function destroyOAuthToken() {
  return function (dispatch){
    return GithubAPI.removeTokenFromOcto().then(() => {
      dispatch(oauthTokenDestroyed());
    }).catch(error => {
      //TODO: Improve error handling instead of re-throwing error
      throw(error);
    });
  };
{'fraction_non_alphanumeric': 0.11133603238866396, 'fraction_numerical': 0.0, 'mean_word_length': 5.4397394136807815, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6245867', 'n_tokens_mistral': 614, 'n_tokens_neox': 612, 'n_words': 132}