This commit is contained in:
Luis Fernando Molina committed 2018-11-02 14:33:40 +01:00
1 parent 9e237e2d7f
commit c560005047
1 file changed
+19 -2
+19 -2
View File
@@ -85,7 +85,8 @@ class ProfileSheet extends Component {
firstNameError: false,
middleNameError: false,
lastNameError: false,
bioError: false
bioError: false,
updated: false
}
}
@@ -134,6 +135,8 @@ class ProfileSheet extends Component {
user.role.id = this.state.roleId
localStorage.setItem('loggedInUser', JSON.stringify(user))
this.setState({updated: true})
}
handleCheckBoxes (e) {
@@ -301,6 +304,14 @@ class ProfileSheet extends Component {
}
}
displayButtonTitle () {
if (this.state.updated === true) {
return 'Updated'
} else {
return 'Update'
}
}
render () {
const { classes } = this.props
return (
@@ -481,7 +492,13 @@ class ProfileSheet extends Component {
<Grid container justify='center' >
<Grid item>
<Button variant='contained' color='secondary' className={classes.button} onClick={this.submitForm.bind(this)}>Update</Button>
<Button
variant='contained'
color='secondary'
className={classes.button}
onClick={this.submitForm.bind(this)}
disabled={this.state.updated}
>{this.displayButtonTitle()}</Button>
</Grid>
</Grid>
</form>