<commit_before>import { createOrder } from 'utils/api'
import { status, json } from 'utils/fetch'
import { routeActions } from 'react-router-redux'
import types from 'constants'

const { SUBMIT_REQUEST, SUBMIT_SUCCESS, SUBMIT_FAILURE } = types

const submitRequest = () => {
    return {
        type: SUBMIT_REQUEST,
        submitting: true
    }
}

const submitSuccess = () => {
    return {
        type: SUBMIT_SUCCESS,
        submitting: false
    }
}

const submitFailure = error => {
    return {
        type: SUBMIT_FAILURE,
        submitting: false,
        error
    }
}

let server = SERVER
if (process.env.SERVER) {
    server = process.env.SERVER
}

// submit dsc order and redirect user to a confirmation page
export const submitOrder = () => {
    return (dispatch, getState) => {
        const state = getState()
        dispatch(submitRequest())
        createOrder(server, state.order)
        .then(status)
        .then(json)
        .then(order => {
            dispatch(submitSuccess())
            // dispatch(routeActions.push('/order/submitted'))
            console.log('submitted successfully', order)
        })
        .catch(error => {
            dispatch(submitFailure(error))
            console.log('errorrr')
        })
    }
}<commit_msg>updated to redirect user to next page #20<commit_after>import { createOrder } from 'utils/api'
import { status, json } from 'utils/fetch'
import { routeActions } from 'react-router-redux'
import types from 'constants'

const { SUBMIT_REQUEST, SUBMIT_SUCCESS, SUBMIT_FAILURE } = types

const submitRequest = () => {
    return {
        type: SUBMIT_REQUEST,
        submitting: true
    }
}

const submitSuccess = order => {
    return {
        type: SUBMIT_SUCCESS,
        submitting: false,
        order
    }
}

const submitFailure = error => {
    return {
        type: SUBMIT_FAILURE,
        submitting: false,
        error
    }
}

let server = SERVER
if (process.env.SERVER) {
    server = process.env.SERVER
}

// submit dsc order and redirect user to a confirmation page
export const submitOrder = () => {
    return (dispatch, getState) => {
        const { order } = getState()
        dispatch(submitRequest())
        createOrder(server, order)
        .then(status)
        .then(json)
        .then(response => {
            dispatch(submitSuccess(response.data))
            dispatch(routeActions.push('/order/submitted'))
        })
        .catch(error => {
            dispatch(submitFailure(error))
        })
    }
}
{'fraction_non_alphanumeric': 0.11384371281237604, 'fraction_numerical': 0.0007933359777865926, 'mean_word_length': 2.3271767810026387, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '4710452', 'n_tokens_mistral': 714, 'n_tokens_neox': 729, 'n_words': 175}