<commit_before>export const GET_ORDERS = 'GET_ORDERS';
export const GET_ORDER = 'GET_ORDER';
export const CREATE_ORDER = 'CREATE_ORDER';
export const DELETE_ORDER = 'DELETE_ORDER';
export const UPDATE_ORDER = 'UPDATE_ORDER';

export const getOrders = (orders) => ({ type: GET_ORDERS, receivedOrders: orders});
export const getOrder = (order) => ({ type: GET_ORDER, receivedOrder: order});
export const createOrder = (order) => ({ type: CREATE_ORDER, orderToCreate: order});
export const deleteOrder = (order) => ({ type: DELETE_ORDER, orderToDelete: order});
export const updateOrder = (order) => ({ type: UPDATE_ORDER, orderToUpdate: order});<commit_msg>feat(orders redux): adds dispatchers<commit_after>import axios from 'axios';

/* -----------------    ACTIONS     ------------------ */
export const GET_ORDERS = 'GET_ORDERS';
export const GET_ORDER = 'GET_ORDER';
export const CREATE_ORDER = 'CREATE_ORDER';
export const DELETE_ORDER = 'DELETE_ORDER';
export const UPDATE_ORDER = 'UPDATE_ORDER';

/* ------------   ACTION CREATORS     ------------------ */
const getOrders = (orders) => ({ type: GET_ORDERS, receivedOrders: orders});
const getOrder = (order) => ({ type: GET_ORDER, receivedOrder: order});
const createOrder = (order) => ({ type: CREATE_ORDER, orderToCreate: order});
const deleteOrder = (order) => ({ type: DELETE_ORDER, orderToDelete: order});
const updateOrder = (order) => ({ type: UPDATE_ORDER, orderToUpdate: order});

/* ------------       DISPATCHERS     ------------------ */
export const fetchOrders = () => dispatch => {
        axios.get('/api/orders')
        .then(res => dispatch(getOrders(res.data)))
        .catch(err => console.error('Fetching orders unsuccessful', err))
}

export const fetchOrder = (id) => dispatch => {
    axios.get(`/api/order/${id}`)
        .then(res => dispatch(getOrder(res.data)))
        .catch(err => console.error('Fetching order unsuccessful', err))
}

export const addOrder = order => dispatch => {
    axios.post('/api/orders', order)
        .then(res => dispatch(createOrder(res.data)))
        .catch(err => console.error(`Creating order: ${order} unsuccessful`, err))
}

export const changeOrder = (id, order) => dispatch => {
    axios.put(`/api/orders/${id}`, order)
        .then(res => dispatch(updateOrder(res.data)))
        .catch(err => console.error(`Updating order: ${order} unsuccessful`, err))
}

export const removeOrder = id => dispatch => {
  dispatch(deleteOrder(id));
  axios.delete(`/api/stories/${id}`)
       .catch(err => console.error(`Removing order: ${id} unsuccessful`, err));
}
{'fraction_non_alphanumeric': 0.19108527131782946, 'fraction_numerical': 0.0, 'mean_word_length': 3.744485294117647, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 32, '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': '7619849', 'n_tokens_mistral': 768, 'n_tokens_neox': 753, 'n_words': 194}