Skip to content
Snippets Groups Projects
Commit a4e53b1b authored by Zhan Huang's avatar Zhan Huang
Browse files

465

parent a3c79c26
No related branches found
No related tags found
2 merge requests!111Shared data model,!113Dev
......@@ -27,6 +27,9 @@ const SearchArea = styled.div`
flex-wrap: wrap;
}
`
let errorTimer
class SearchBoxes extends React.Component {
state = {
id: SearchBoxes.id ? SearchBoxes.id : '',
......@@ -34,19 +37,32 @@ class SearchBoxes extends React.Component {
errors: [],
}
componentDidUpdate() {
if (this.state.errors && this.area) {
setTimeout(() => {
const { errors } = this.state
if (errorTimer) {
clearTimeout(errorTimer)
}
if (errors && this.area) {
errorTimer = setTimeout(() => {
this.setState({ errors: [] })
}, 10000)
}
}
componentWillUnmount() {
clearTimeout(errorTimer)
}
static id = ''
static search = ''
setRef = area => {
this.area = area
}
onSearchValChanged = e => {
this.setState({ [e.target.name]: e.target.value })
this.setState({
[e.target.name]: e.target.value,
errors: [],
})
SearchBoxes[e.target.name] = e.target.value
}
onSearchValSubmitted = (where, e) => {
......
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