2020-04-08 21:12:58 +05:00
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
2022-08-04 13:31:14 +02:00
|
|
|
import selectors from '../selectors';
|
|
|
|
import entryActions from '../entry-actions';
|
2020-04-08 21:12:58 +05:00
|
|
|
import UserSettingsModal from '../components/UserSettingsModal';
|
|
|
|
|
|
|
|
const mapStateToProps = (state) => {
|
|
|
|
const {
|
|
|
|
email,
|
|
|
|
name,
|
|
|
|
username,
|
2020-04-21 05:04:34 +05:00
|
|
|
avatarUrl,
|
2020-04-09 18:27:28 +05:00
|
|
|
phone,
|
|
|
|
organization,
|
2022-07-26 12:26:42 +02:00
|
|
|
language,
|
2020-04-10 00:11:34 +05:00
|
|
|
subscribeToOwnCards,
|
2020-04-21 05:04:34 +05:00
|
|
|
isAvatarUpdating,
|
2020-04-08 21:12:58 +05:00
|
|
|
emailUpdateForm,
|
|
|
|
passwordUpdateForm,
|
|
|
|
usernameUpdateForm,
|
2022-08-04 13:31:14 +02:00
|
|
|
} = selectors.selectCurrentUser(state);
|
2020-04-08 21:12:58 +05:00
|
|
|
|
|
|
|
return {
|
|
|
|
email,
|
|
|
|
name,
|
|
|
|
username,
|
2020-04-21 05:04:34 +05:00
|
|
|
avatarUrl,
|
2020-04-09 18:27:28 +05:00
|
|
|
phone,
|
|
|
|
organization,
|
2022-07-26 12:26:42 +02:00
|
|
|
language,
|
2020-04-10 00:11:34 +05:00
|
|
|
subscribeToOwnCards,
|
2020-04-21 05:04:34 +05:00
|
|
|
isAvatarUpdating,
|
2020-04-08 21:12:58 +05:00
|
|
|
emailUpdateForm,
|
|
|
|
passwordUpdateForm,
|
|
|
|
usernameUpdateForm,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch) =>
|
|
|
|
bindActionCreators(
|
|
|
|
{
|
2022-08-04 13:31:14 +02:00
|
|
|
onUpdate: entryActions.updateCurrentUser,
|
|
|
|
onAvatarUpdate: entryActions.updateCurrentUserAvatar,
|
|
|
|
onLanguageUpdate: entryActions.updateCurrentUserLanguage,
|
|
|
|
onUsernameUpdate: entryActions.updateCurrentUserUsername,
|
|
|
|
onUsernameUpdateMessageDismiss: entryActions.clearCurrentUserUsernameUpdateError,
|
|
|
|
onEmailUpdate: entryActions.updateCurrentUserEmail,
|
|
|
|
onEmailUpdateMessageDismiss: entryActions.clearCurrentUserEmailUpdateError,
|
|
|
|
onPasswordUpdate: entryActions.updateCurrentUserPassword,
|
|
|
|
onPasswordUpdateMessageDismiss: entryActions.clearCurrentUserPasswordUpdateError,
|
|
|
|
onClose: entryActions.closeModal,
|
2020-04-08 21:12:58 +05:00
|
|
|
},
|
|
|
|
dispatch,
|
|
|
|
);
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(UserSettingsModal);
|