diff --git a/src/components/team/add-member-details.js b/src/components/team/add-member-details.js index 3b485d6..9b30bfc 100644 --- a/src/components/team/add-member-details.js +++ b/src/components/team/add-member-details.js @@ -13,6 +13,7 @@ import { Loader, Modal, Image, + Message, } from 'semantic-ui-react' import styles from '../../css/team/add-member-details.css' @@ -71,6 +72,7 @@ class AddMemberDetails extends Component { prevUploadedFileN: null, errorHandle: false, errorShortBio: false, + errorMessage: '', errorUrl: false, techSkillsOptions: [], socialLinksOptions: [], @@ -285,6 +287,8 @@ class AddMemberDetails extends Component { }) .catch(function(response) { //handle error + window.scrollTo(0,0) + that.setState({ errorMessage: response.response.data }) if (response.response.data.handle != null) { that.setState({ errorHandle: true }) } @@ -343,6 +347,7 @@ class AddMemberDetails extends Component { } if (this.state.loaded) { + const { errorHandle, errorShortBio, errorMessage } = this.state return (
@@ -351,6 +356,21 @@ class AddMemberDetails extends Component { ? 'Add Member Details' : 'Modify Member Details'} + {( errorHandle || errorShortBio) && ( + + There was some errors with your submission + { + Object.keys(errorMessage).forEach(function(field) { + const errors = errorMessage[field]; + errors.forEach(err => + ( +

{field} : {err}

+ ) + ) + }) + } +
+ )}
@@ -363,11 +383,6 @@ class AddMemberDetails extends Component { }} value={this.state.handle} /> - {this.state.errorHandle && ( - - )} - {this.state.errorShortBio && ( - - )}