You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Tag:
Branch:
Tree:
8b53350501
develop
feature/default_network_editable
v10.22.3
${ noResults }
45 lines
1.1 KiB
45 lines
1.1 KiB
import { connect } from 'react-redux';
|
|||
import * as actions from '../../../../store/actions';
|
|||
import NewAccountModal from './new-account-modal.component';
|
|||
|
|||
|
function mapStateToProps(state) {
|
||
return {
|
|||
...(state.appState.modal.modalState.props || {}),
|
|||
};
|
|||
}
|
|||
|
|||
|
function mapDispatchToProps(dispatch) {
|
||
return {
|
|||
hideModal: () => dispatch(actions.hideModal()),
|
|||
|
createAccount: (newAccountName) => {
|
||
|
return dispatch(actions.addNewAccount()).then((newAccountAddress) => {
|
||
if (newAccountName) {
|
|||
dispatch(actions.setAccountLabel(newAccountAddress, newAccountName));
|
|||
|
}
|
||
return newAccountAddress;
|
|||
});
|
|||
},
|
|||
};
|
|||
}
|
|||
|
|||
|
function mergeProps(stateProps, dispatchProps) {
|
||
const { onCreateNewAccount } = stateProps;
|
|||
const { createAccount } = dispatchProps;
|
|||
|
|||
return {
|
|||
...stateProps,
|
|||
...dispatchProps,
|
|||
onSave: (newAccountName) => {
|
|||
|
return createAccount(newAccountName).then((newAccountAddress) =>
|
||
onCreateNewAccount(newAccountAddress),
|
|||
);
|
|||
},
|
|||
};
|
|||
}
|
|||
|
|||
|
export default connect(
|
||
mapStateToProps,
|
|||
mapDispatchToProps,
|
|||
mergeProps,
|
|||
)(NewAccountModal);
|