Commit afbeffd2 authored by Linh Nguyen's avatar Linh Nguyen

prohibit add student in current list

parent 121babbf
......@@ -31,9 +31,14 @@ class App extends Component {
}
addLogin = (login) => {
this.setState({
logins: [...this.state.logins, login]
})
if (!this.state.logins.includes(login)) {
this.setState({
logins: [...this.state.logins, login]
})
} else {
alert("Student has been added in list. Please enter another login !");
}
}
deleteLogin = (login) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment