Skip to content

Commit

Permalink
Update store/search, allow uppercase in block hash and tx hash
Browse files Browse the repository at this point in the history
  • Loading branch information
emiliorizzo committed Mar 4, 2020
1 parent 62039bd commit d80782a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/store/modules/search/actions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import { testSearchedValue } from '../../../lib/js/validate'
import { isHexString, isTxOrBlockHash } from 'rsk-utils/dist/strings'
const DEFAULT_TYPE = 'addressByName'

const createSearchKey = (value, type) => {
Expand All @@ -15,6 +16,8 @@ export const clearSearchedResults = async ({ commit, dispatch, getters }) => {

export const updateSearchedValue = async ({ commit, dispatch, state }, value) => {
value = String(value).replace(/[\W_]+/g, '')
let lcValue = value.toLowerCase()
value = (isHexString(value) && isTxOrBlockHash(lcValue)) ? lcValue : value
if (state.value !== value) {
commit('SET_SEARCH_VALUE', value)
await dispatch('clearSearchedResults')
Expand Down

0 comments on commit d80782a

Please sign in to comment.