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-07-29 11:30:12 +02:00 committed by Matthias Kretschmann
parent d0461228d5
commit 851777a1a6
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -123,38 +123,49 @@ class Search extends PureComponent<SearchProps, SearchState> {
search: `?text=${this.state.searchTerm}&page=${toPage}`
})
this.setState({ currentPage: toPage, isLoading: true }, () => this.searchAssets())
this.setState({ currentPage: toPage, isLoading: true }, () =>
this.searchAssets()
)
}
private inputChange = (event: ChangeEvent<HTMLInputElement> | ChangeEvent<HTMLSelectElement>) => {
private inputChange = (
event: ChangeEvent<HTMLInputElement> | ChangeEvent<HTMLSelectElement>
) => {
this.setState({
[event.currentTarget.name]: event.currentTarget.value
} as any)
}
private search = (event: ChangeEvent<HTMLInputElement>) => {
let searchUrl = '?'
if (this.state.search) {
searchUrl = `${searchUrl}text=${encodeURIComponent(this.state.search)}&`
searchUrl = `${searchUrl}text=${encodeURIComponent(
this.state.search
)}&`
}
if (this.state.category) {
searchUrl = `${searchUrl}categories=${encodeURIComponent(this.state.category)}&`
searchUrl = `${searchUrl}categories=${encodeURIComponent(
this.state.category
)}&`
}
if (this.state.license) {
searchUrl = `${searchUrl}license=${encodeURIComponent(this.state.license)}&`
searchUrl = `${searchUrl}license=${encodeURIComponent(
this.state.license
)}&`
}
this.props.history.push({
pathname: this.props.location.pathname,
search: searchUrl
})
this.setState({
this.setState(
{
searchTerm: this.state.search,
currentPage: 1,
isLoading: true
}, () => this.searchAssets())
},
() => this.searchAssets()
)
}
public renderResults = () =>