1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

url encode & decode search term

This commit is contained in:
Matthias Kretschmann 2019-05-16 13:27:41 +02:00
parent d49cace56a
commit c5a4a15a3a
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -41,7 +41,7 @@ export default class Search extends PureComponent<SearchProps, SearchState> {
const searchPage = queryString.parse(this.props.location.search).page
await this.setState({
searchTerm: JSON.stringify(searchTerm)
searchTerm: encodeURIComponent(`${searchTerm}`)
})
// switch to respective page if query string is present
@ -60,7 +60,7 @@ export default class Search extends PureComponent<SearchProps, SearchState> {
offset: this.state.offset,
page: this.state.currentPage,
query: {
text: [this.state.searchTerm],
text: [decodeURIComponent(this.state.searchTerm)],
price: [-1, 1]
},
sort: {
@ -117,9 +117,9 @@ export default class Search extends PureComponent<SearchProps, SearchState> {
<h2
className={styles.resultsTitle}
dangerouslySetInnerHTML={{
__html: `${totalResults} results for <span>${
__html: `${totalResults} results for <span>${decodeURIComponent(
this.state.searchTerm
}</span>`
)}</span>`
}}
/>
)}