mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
Merge pull request #130 from oceanprotocol/fix/search-term
url encode & decode search term
This commit is contained in:
commit
c7418a172c
@ -41,7 +41,7 @@ export default class Search extends PureComponent<SearchProps, SearchState> {
|
|||||||
const searchPage = queryString.parse(this.props.location.search).page
|
const searchPage = queryString.parse(this.props.location.search).page
|
||||||
|
|
||||||
await this.setState({
|
await this.setState({
|
||||||
searchTerm: JSON.stringify(searchTerm)
|
searchTerm: encodeURIComponent(`${searchTerm}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
// switch to respective page if query string is present
|
// 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,
|
offset: this.state.offset,
|
||||||
page: this.state.currentPage,
|
page: this.state.currentPage,
|
||||||
query: {
|
query: {
|
||||||
text: [this.state.searchTerm],
|
text: [decodeURIComponent(this.state.searchTerm)],
|
||||||
price: [-1, 1]
|
price: [-1, 1]
|
||||||
},
|
},
|
||||||
sort: {
|
sort: {
|
||||||
@ -117,9 +117,9 @@ export default class Search extends PureComponent<SearchProps, SearchState> {
|
|||||||
<h2
|
<h2
|
||||||
className={styles.resultsTitle}
|
className={styles.resultsTitle}
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: `${totalResults} results for <span>${
|
__html: `${totalResults} results for <span>${decodeURIComponent(
|
||||||
this.state.searchTerm
|
this.state.searchTerm
|
||||||
}</span>`
|
)}</span>`
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
Loading…
Reference in New Issue
Block a user