mirror of
https://github.com/plankanban/planka.git
synced 2025-12-27 09:14:59 +03:00
Initial commit
This commit is contained in:
41
client/src/containers/AddUserPopupContainer.js
Executable file
41
client/src/containers/AddUserPopupContainer.js
Executable 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);
|
||||
Reference in New Issue
Block a user