Initial commit

This commit is contained in:
Maksim Eltyshev
2019-08-31 04:07:25 +05:00
commit 36fe34e8e1
583 changed files with 91539 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { clearUserCreationError, createUser } from '../actions/entry';
import AddUserPopup from '../components/AddUserPopup';
const mapStateToProps = ({ user: { data: defaultData, isSubmitting, error: externalError } }) => {
let error;
if (externalError) {
if (externalError.message === 'User is already exist') {
error = {
message: 'userIsAlreadyExist',
};
} else {
error = {
type: 'warning',
message: 'unknownError',
};
}
}
return {
defaultData,
isSubmitting,
error,
};
};
const mapDispatchToProps = (dispatch) => bindActionCreators(
{
onCreate: createUser,
onMessageDismiss: clearUserCreationError,
},
dispatch,
);
export default connect(
mapStateToProps,
mapDispatchToProps,
)(AddUserPopup);