<commit_before>// Actions will go here
import axios from 'axios';
import { browserHistory } from 'react-router';
import * as TYPES from '../constants/actions';

const API_URL = 'http://localhost:8080';

export const signinUser = ({ email, password }) => {
	return function(dispatch) {
		axios.post(`${API_URL}/user/signin`, { email, password })
			// if signin is successful
			.then(response => {
				console.log('response inside signinUser : ',response);
				dispatch({ type: TYPES.AUTHORIZE_USER });
				// -Save the JWT token
				localStorage.setItem('token', response.data.token);
				browserHistory.push('/icebox');
			})
			// else, dispatch authError action creator
			.catch(response => {
				dispatch(authError(response));
			});
	}
}

export const signupUser = ({ email, name, password }) => {
	return function(dispatch) {
		axios.post(`${API_URL}/user/signup`, { email, name, password })
			// if signup is successful
			.then(response => {
				dispatch({ type: TYPES.AUTHORIZE_USER });
				// -Save the JWT token
				localStorage.setItem('token', response.data.token);
				browserHistory.push('/icebox');
			})
			// else, dispatch authError action creator
			.catch(response => {
				console.log('error in signup user, response of : ',response);
				dispatch(authError(response.data.error));
			});
	}
}

export const signoutUser = () => {
	localStorage.removeItem('token');
	browserHistory.push('/');
	return function(dispatch) {
		dispatch({ type: TYPES.DEAUTHORIZE_USER });
	}
}

export const authError = (error) => ({
	type: TYPES.AUTHORIZE_ERROR,
	payload: error
})

export const setSortBy = (sort) => ({
	type: TYPES.SET_SORT,
	sort
});

export const setSortOrder = (order) => ({
	type: TYPES.SET_SORT_ORDER,
	order
});<commit_msg>[pull] adds user actions to actions/index<commit_after>// Actions will go here
import axios from 'axios';
import { browserHistory } from 'react-router';
import * as TYPES from '../constants/actions';

const API_URL = 'http://localhost:8080';

export const signinUser = ({ email, password }) => {
	return function(dispatch) {
		axios.post(`${API_URL}/user/signin`, { email, password })
			.then(response => {
				console.log('response inside signinUser : ',response);
				dispatch({ type: TYPES.AUTHORIZE_USER });
				dispatch({ type: TYPES.GET_USER_INFO, payload: response.data });
				localStorage.setItem('token', response.data.token);
				browserHistory.push('/icebox');
			})
			.catch(response => {
				dispatch(authError(response));
			});
	}
}

export const signupUser = ({ email, name, password }) => {
	return function(dispatch) {
		axios.post(`${API_URL}/user/signup`, { email, name, password })
			.then(response => {
				dispatch({ type: TYPES.AUTHORIZE_USER });
				dispatch({ type: TYPES.GET_USER_INFO, payload: response.data });
				localStorage.setItem('token', response.data.token);
				browserHistory.push('/icebox');
			})
			.catch(response => {
				console.log('error in signup user, response of : ',response);
				dispatch(authError(response.data.error));
			});
	}
}

export const signoutUser = () => {
	localStorage.removeItem('token');
	browserHistory.push('/');
	return function(dispatch) {
		dispatch({ type: TYPES.DEAUTHORIZE_USER });
		dispatch({ type: TYPES.CLEAR_USER_INFO });
	}
}

export const authError = (error) => ({
	type: TYPES.AUTHORIZE_ERROR,
	payload: error
})

export const setSortBy = (sort) => ({
	type: TYPES.SET_SORT,
	sort
});

export const setSortOrder = (order) => ({
	type: TYPES.SET_SORT_ORDER,
	order
});
{'fraction_non_alphanumeric': 0.16310236669518108, 'fraction_numerical': 0.0022811519817507843, 'mean_word_length': 4.040229885057471, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '878917', 'n_tokens_mistral': 1251, 'n_tokens_neox': 1133, 'n_words': 252}