<commit_before>import petitionRepository from 'services/api/repositories/petition';
import getPetitionURL from 'helpers/getPetitionURL';
import isUntrustedUser from 'helpers/isUntrustedUser';
import settings from 'settings';

import {
  SUBMITTING_SUPPORT,
  SUPPORTED_PETITION
} from './actionTypes';

import {
  showFlashMessage
} from './FlashActions';

import {
  showModalWindow
} from './ModalActions';

export function submittingSupport () {
  return {
    type: SUBMITTING_SUPPORT
  };
}

export function supportPetition (trustData, dispatch) {
  dispatch(submittingSupport());
  console.log(trustData);
  const mockPetitionForNow = { id: trustData.petitionId };
  return petitionRepository.support(trustData)
    .then((response) => {
      console.log('response', response);
      if (isUntrustedUser(response)) {
        // THIS WILL BE WHERE WE SHOW THE TAN PAGE
      }
      // THIS IS THE TRUSTED USER FLOW
      console.log(mockPetitionForNow);
      return dispatch(supportedPetition(mockPetitionForNow));
    }).then((response) => dispatch(
      showModalWindow({
        type: 'supported',
        link: getPetitionURL(mockPetitionForNow.id),
        ...settings.supportPetition.newlySupported.modal
      })
    )).catch((e) => {
      console.log('error', e);<commit_msg>Remove stray console logs<commit_after>import petitionRepository from 'services/api/repositories/petition';
import getPetitionURL from 'helpers/getPetitionURL';
import isUntrustedUser from 'helpers/isUntrustedUser';
import settings from 'settings';

import {
  SUBMITTING_SUPPORT,
  SUPPORTED_PETITION
} from './actionTypes';

import {
  showFlashMessage
} from './FlashActions';

import {
  showModalWindow
} from './ModalActions';

export function submittingSupport () {
  return {
    type: SUBMITTING_SUPPORT
  };
}

export function supportPetition (trustData, dispatch) {
  dispatch(submittingSupport());
  const mockPetitionForNow = { id: trustData.petitionId };
  return petitionRepository.support(trustData)
    .then((response) => {
      if (isUntrustedUser(response)) {
        // THIS WILL BE WHERE WE SHOW THE TAN PAGE
      }
      // THIS IS THE TRUSTED USER FLOW
      return dispatch(supportedPetition(mockPetitionForNow));
    }).then((response) => dispatch(
      showModalWindow({
        type: 'supported',
        link: getPetitionURL(mockPetitionForNow.id),
        ...settings.supportPetition.newlySupported.modal
      })
    )).catch((e) => {
      // console.log('error', e);
{'fraction_non_alphanumeric': 0.11422845691382766, 'fraction_numerical': 0.0, 'mean_word_length': 3.8560311284046693, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '900572', 'n_tokens_mistral': 744, 'n_tokens_neox': 702, 'n_words': 162}