From 7302255578508db07fd8201cbf45ce16657d273d Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Thu, 12 Jan 2023 22:27:30 +0530 Subject: [PATCH] Bug fixes --- index.html | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 3aff1dd..2e9982f 100644 --- a/index.html +++ b/index.html @@ -197,7 +197,12 @@ document.addEventListener('copy', () => { notify('copied', 'success') }) - routeTo(window.location.hash) + getAllSuggestions().then(suggestions => { + routeTo(window.location.hash) + }).catch(e => { + console.error(e) + notify(e, 'error') + }) getRef("main_search_field").addEventListener("keydown", function (e) { if (e.key === 'Enter') { processNavbarSearch() @@ -226,8 +231,6 @@ getRef("main_search_field").value = document.activeElement.textContent.trim() }); - getAllSuggestions(); - this.addEventListener("click", (e) => { if (e.target.closest('.suggestion')) { let searchBox = document.getElementById('main_search_field'); @@ -1478,15 +1481,17 @@ location.href = `#/contract/${text}` resolve('contract') } else if (text.length == 64 && returnHexNumber(text)) { - fetch(`${window.tokenApiUrl}/api/v1.0/categoriseString/` + text) + fetchJson(`${window.tokenApiUrl}/api/v1.0/categoriseString/` + text) .then(function (myJson) { + console.log(`${window.tokenApiUrl}/api/v1.0/categoriseString/` + text) console.log(myJson) if (myJson['type'] == 'transaction') { //console.log('data entered is a transaction hash'); location.href = `#/transaction/${text}` } else if (myJson['type'] == 'block') { - //console.log('data entered is a block hash'); - location.href = `#/block/${myJson['blockNumber']}` + console.log('data entered is a block hash'); + + location.href = `#/block/${text}` } else { //console.log('data entered is noise'); }