mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
linting
This commit is contained in:
parent
c28974f019
commit
111f4668de
@ -32,7 +32,9 @@ interface SearchState {
|
|||||||
|
|
||||||
class Search extends PureComponent<SearchProps, SearchState> {
|
class Search extends PureComponent<SearchProps, SearchState> {
|
||||||
public static contextType = User
|
public static contextType = User
|
||||||
|
|
||||||
public timeout: any = false
|
public timeout: any = false
|
||||||
|
|
||||||
public state = {
|
public state = {
|
||||||
results: [],
|
results: [],
|
||||||
totalResults: 0,
|
totalResults: 0,
|
||||||
@ -49,7 +51,7 @@ class Search extends PureComponent<SearchProps, SearchState> {
|
|||||||
const { search } = this.props.location
|
const { search } = this.props.location
|
||||||
const { text, page, categories, license } = queryString.parse(search)
|
const { text, page, categories, license } = queryString.parse(search)
|
||||||
|
|
||||||
let update: any = {}
|
const update: any = {}
|
||||||
if (text) {
|
if (text) {
|
||||||
update.search = decodeURIComponent(`${text}`)
|
update.search = decodeURIComponent(`${text}`)
|
||||||
}
|
}
|
||||||
@ -131,22 +133,25 @@ class Search extends PureComponent<SearchProps, SearchState> {
|
|||||||
private inputChange = (
|
private inputChange = (
|
||||||
event: ChangeEvent<HTMLInputElement> | ChangeEvent<HTMLSelectElement>
|
event: ChangeEvent<HTMLInputElement> | ChangeEvent<HTMLSelectElement>
|
||||||
) => {
|
) => {
|
||||||
this.setState({
|
this.setState(
|
||||||
|
{
|
||||||
[event.currentTarget.name]: event.currentTarget.value
|
[event.currentTarget.name]: event.currentTarget.value
|
||||||
} as any, () => {
|
} as any,
|
||||||
|
() => {
|
||||||
this.pendingSearch()
|
this.pendingSearch()
|
||||||
})
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private pendingSearch = () => {
|
private pendingSearch = () => {
|
||||||
this.setState({isLoading:true})
|
this.setState({ isLoading: true })
|
||||||
if(this.timeout){
|
if (this.timeout) {
|
||||||
clearTimeout(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.timeout = false
|
||||||
this.searchAssets()
|
this.searchAssets()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user