From 111f4668dead53d6afa9c02d7a12e753389f053f Mon Sep 17 00:00:00 2001 From: Jernej Pregelj Date: Tue, 6 Aug 2019 11:54:32 +0200 Subject: [PATCH] linting --- client/src/routes/Search/index.tsx | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/client/src/routes/Search/index.tsx b/client/src/routes/Search/index.tsx index 565581b..473a6b4 100644 --- a/client/src/routes/Search/index.tsx +++ b/client/src/routes/Search/index.tsx @@ -32,7 +32,9 @@ interface SearchState { class Search extends PureComponent { public static contextType = User + public timeout: any = false + public state = { results: [], totalResults: 0, @@ -49,7 +51,7 @@ class Search extends PureComponent { const { search } = this.props.location const { text, page, categories, license } = queryString.parse(search) - let update: any = {} + const update: any = {} if (text) { update.search = decodeURIComponent(`${text}`) } @@ -131,22 +133,25 @@ class Search extends PureComponent { private inputChange = ( event: ChangeEvent | ChangeEvent ) => { - this.setState({ - [event.currentTarget.name]: event.currentTarget.value - } as any, () => { - this.pendingSearch() - }) + this.setState( + { + [event.currentTarget.name]: event.currentTarget.value + } as any, + () => { + this.pendingSearch() + } + ) } private pendingSearch = () => { - this.setState({isLoading:true}) - if(this.timeout){ + this.setState({ isLoading: true }) + if (this.timeout) { clearTimeout(this.timeout) } - this.timeout = setTimeout(this.executeSearch,500); + this.timeout = setTimeout(this.executeSearch, 500) } - private executeSearch=()=>{ + private executeSearch = () => { this.timeout = false this.searchAssets() }