mirror of
https://github.com/dap-ps/discover.git
synced 2025-02-07 06:54:49 +00:00
Fix search logic
This commit is contained in:
parent
38cc479a54
commit
b50ea64449
@ -19,7 +19,13 @@ class Search extends React.Component {
|
||||
const { value } = e.target
|
||||
const { dappState } = this.props
|
||||
if (value.length > 1) {
|
||||
const dapps = dappState.dapps.filter(dapp => dapp.name.startsWith(value))
|
||||
const searchExp = new RegExp(value, 'i')
|
||||
const dapps = dappState.dapps.filter(dapp => {
|
||||
if (dapp.name.search(searchExp) != -1) {
|
||||
return dapp
|
||||
}
|
||||
return null
|
||||
})
|
||||
this.setState({ dapps, isSearching: true })
|
||||
} else if (value === '') {
|
||||
this.setState({
|
||||
|
Loading…
x
Reference in New Issue
Block a user