1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00
This commit is contained in:
Jernej Pregelj 2019-08-06 11:54:32 +02:00 committed by Matthias Kretschmann
parent c28974f019
commit 111f4668de
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -32,7 +32,9 @@ interface SearchState {
class Search extends PureComponent<SearchProps, SearchState> {
public static contextType = User
public timeout: any = false
public state = {
results: [],
totalResults: 0,
@ -49,7 +51,7 @@ class Search extends PureComponent<SearchProps, SearchState> {
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,11 +133,14 @@ class Search extends PureComponent<SearchProps, SearchState> {
private inputChange = (
event: ChangeEvent<HTMLInputElement> | ChangeEvent<HTMLSelectElement>
) => {
this.setState({
this.setState(
{
[event.currentTarget.name]: event.currentTarget.value
} as any, () => {
} as any,
() => {
this.pendingSearch()
})
}
)
}
private pendingSearch = () => {
@ -143,7 +148,7 @@ class Search extends PureComponent<SearchProps, SearchState> {
if (this.timeout) {
clearTimeout(this.timeout)
}
this.timeout = setTimeout(this.executeSearch,500);
this.timeout = setTimeout(this.executeSearch, 500)
}
private executeSearch = () => {