Add email and password change functionality for a current user, remove deep compare hooks

This commit is contained in:
Maksim Eltyshev
2019-10-18 08:06:34 +05:00
parent b53e5bf94c
commit 680d664279
67 changed files with 1232 additions and 267 deletions

View File

@@ -1,36 +1,19 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { clearUserCreationError, createUser } from '../actions/entry';
import { clearUserCreateError, 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 mapStateToProps = ({ userCreateForm: { data: defaultData, isSubmitting, error } }) => ({
defaultData,
isSubmitting,
error,
});
const mapDispatchToProps = (dispatch) => bindActionCreators(
{
onCreate: createUser,
onMessageDismiss: clearUserCreationError,
onMessageDismiss: clearUserCreateError,
},
dispatch,
);