import React from 'react';
import {connect} from 'react-redux';
import UList from '../../components/AdminPage/UserList';
import {add_dialog_msg, edit_user, get_user_list, add_user, del_user,clear_userlist} from '../../actions';

const mapStateToProps = (state) => ({
	i18n: state.i18n,
	users: state.lists.user || []
});

const mapDispatchToProps = (dispatch, ownProps) => ({
	showDialog: (msg) => {
		dispatch(add_dialog_msg(msg));
	},
	clearList: () => {
		dispatch(clear_userlist())
	},
	getList: () => {
		dispatch(get_user_list());
	},
	addUser: data => {
		dispatch(add_user(data));
	},
	editUser: data => {
		dispatch(edit_user(data));
	},
	delUser: data=>{
		dispatch(del_user(data));
	}
})

export default connect(mapStateToProps, mapDispatchToProps)(UList);