diff --git a/src/components/ErrorAlert/index.js b/src/components/ErrorAlert/index.js index 87d606aaf9ca9c134714ee9a572678b70c6c1883..e0fdbc007142f890664a43709d676c3de513b6c4 100644 --- a/src/components/ErrorAlert/index.js +++ b/src/components/ErrorAlert/index.js @@ -15,7 +15,7 @@ class ErrorAlert extends Component { if (error) { error.responseBody.then((res) => { - this.setState({ errMessage: res.data }); + this.setState({ errMessage: JSON.stringify(res.data) }); }); } } diff --git a/src/components/Utilities/index.js b/src/components/Utilities/index.js index c526b49ed449ce8cb03d9d46b026aa72be7bdee7..a5cf9a18a5b42290260d726cac308b4c75e718b2 100644 --- a/src/components/Utilities/index.js +++ b/src/components/Utilities/index.js @@ -210,6 +210,7 @@ class Utilities extends Component { accountId = null, billData = [], disaggregateData = [], + ) => { let accountProps = {}; const { accountsCounter } = this.state; @@ -219,7 +220,7 @@ class Utilities extends Component { account_id: accountId, billData, disaggregateData, - disabled: true, + accountCreated: true, }; } diff --git a/src/components/UtilityAccount/index.js b/src/components/UtilityAccount/index.js index e6e9bf6e7864c799949efb22bf790408f203e740..f1be0dbfff5a281f46e50aef53ae6afb7381bea1 100644 --- a/src/components/UtilityAccount/index.js +++ b/src/components/UtilityAccount/index.js @@ -19,7 +19,8 @@ class UtilityAccount extends Component { account_id: this.props.account_id, billData: this.props.billData, disaggregateData: this.props.disaggregateData, - disabled: this.props.disabled, + accountCreated: this.props.accountCreated, + disableButtons: false, convertingFile: false, displayBillData: false, displayDisaggregateData: false, @@ -154,7 +155,12 @@ class UtilityAccount extends Component { handleCreateAccount = (event) => { event.preventDefault(); - this.setState({ disabled: true }); + this.setState({ + accountCreated: true, + // Disable all of the buttons until the create account returns succesfully + // The buttons will be reenabled when the component is recreated by the parent + disableButtons: true, + }); this.props.createAccount({ ...this.state.form }); } @@ -273,7 +279,7 @@ class UtilityAccount extends Component { name={type} className="file" onChange={this.uploadHandler} - disabled={disabled} + disabled={disabled || this.state.disableButtons} />