Disable button on submit

This commit is contained in:
Ildar Kamalov 2019-02-07 16:09:12 +03:00
parent 826529e73e
commit 91eaf72051
2 changed files with 13 additions and 6 deletions

View File

@ -42,7 +42,11 @@ class Controls extends Component {
<button <button
type="submit" type="submit"
className="btn btn-success btn-standard btn-lg" className="btn btn-success btn-standard btn-lg"
disabled={this.props.invalid || this.props.pristine} disabled={
this.props.invalid
|| this.props.pristine
|| this.props.install.processingSubmit
}
> >
<Trans>next</Trans> <Trans>next</Trans>
</button> </button>
@ -73,11 +77,13 @@ class Controls extends Component {
} }
render() { render() {
const { install } = this.props;
return ( return (
<div className="setup__nav"> <div className="setup__nav">
<div className="btn-list"> <div className="btn-list">
{this.renderPrevButton(this.props.step)} {this.renderPrevButton(install.step)}
{this.renderNextButton(this.props.step)} {this.renderNextButton(install.step)}
</div> </div>
</div> </div>
); );
@ -85,7 +91,7 @@ class Controls extends Component {
} }
Controls.propTypes = { Controls.propTypes = {
step: PropTypes.number.isRequired, install: PropTypes.object.isRequired,
nextStep: PropTypes.func, nextStep: PropTypes.func,
prevStep: PropTypes.func, prevStep: PropTypes.func,
openDashboard: PropTypes.func, openDashboard: PropTypes.func,
@ -96,8 +102,8 @@ Controls.propTypes = {
}; };
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
const { step } = state.install; const { install } = state;
const props = { step }; const props = { install };
return props; return props;
}; };

View File

@ -26,6 +26,7 @@ const install = handleActions({
}, { }, {
step: INSTALL_FIRST_STEP, step: INSTALL_FIRST_STEP,
processingDefault: true, processingDefault: true,
processingSubmit: false,
web: { web: {
ip: '0.0.0.0', ip: '0.0.0.0',
port: 80, port: 80,