diff --git a/templates/index.html b/templates/index.html index bc11520..24208fa 100644 --- a/templates/index.html +++ b/templates/index.html @@ -20,10 +20,6 @@
-
-

Node Status

-
Loading...
-

Chain Info

Loading...
@@ -872,9 +868,6 @@ // Load status on page load async function loadStatus() { - const nodeStatus = await apiCall('status'); - displayResult('node-status', nodeStatus, 'status'); - const chainStatus = await apiCall('chain'); if (chainStatus.chain) { document.getElementById('chain-status').innerHTML = formatChainData(chainStatus.chain); @@ -1040,7 +1033,17 @@ return; } const data = await apiCall(`namehash/${nameHash}`); - displayResult('name-result', data); + + // Check if result is valid and redirect to name page + const resultElement = document.getElementById('name-result'); + if (data.error) { + resultElement.innerHTML = `
Error: ${data.error.message ? data.error.message : "Failed to lookup hash"}
`; + } else if (data.result && typeof data.result === 'string') { + // Valid name found, redirect to name page + window.location.href = `/name/${data.result}`; + } else { + resultElement.innerHTML = `
No name found for this hash
`; + } } async function searchCoin() {