/**
* Кнопка удаления профиля
* @module ProfileEditFormRemoveButton
* @author Ihor Bielchenko
* @requires react
* @requires react#Component
* @requires react-redux#connect
* @requires redux#bindActionCreators
* @requires actions/StateConfigAction.js
*/
import React, { Component } from 'react';
import Link from '../../../Common/Link.jsx';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import * as StateConfigAction from '../../../../actions/StateConfigAction.js';
/**
* Кнопка удаления профиля
* @extends Component
*/
class ProfileEditFormRemoveButton extends Component {
/**
* Удалить аккаунт
* @fires click
* @param {Object} e
*/
removeProfile(e) {
this.props.config.confirm_remove_profile = 1;
this.props.StateConfigAction.update(this.props.config);
}
/**
* Render component
* @return {Object} jsx object
*/
render() {
return <div className="block2">
<span className="main-span">{this.props.lang.edit_remove_profile_title}</span>
<Link className="button"
onClick={this.removeProfile.bind(this)}>{this.props.lang.edit_remove_title}</Link>
</div>
}
}
/**
* Init redux states
* @param {Object} state
* @return {Object}
*/
function mapStateToProps(state) {
return {
lang: state.lang,
config: state.config,
}
}
/**
* Init redux actions
* @param {Function} dispatch
* @return {Object}
*/
function mapDispatchToProps(dispatch) {
return {
StateConfigAction: bindActionCreators(StateConfigAction, dispatch),
}
}
export default connect(mapStateToProps, mapDispatchToProps)(ProfileEditFormRemoveButton);