1
0
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:
Onuwa Nnachi Isaac 2019-09-13 01:16:20 +01:00 committed by Andy Tudhope
parent 38cc479a54
commit b50ea64449

View File

@ -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({