fix search block
This commit is contained in:
parent
14c1c5d830
commit
bf0e65d754
2 changed files with 3 additions and 1 deletions
|
|
@ -62,7 +62,7 @@ function Block(props: BlockProps) {
|
|||
|
||||
useEffect(() => {
|
||||
async function fetchHash() {
|
||||
if (!height) return;
|
||||
if (height === null) return;
|
||||
const prevHashFetched = await Fetch.getHashByHeight(height - 1);
|
||||
const nextHashFetched = await Fetch.getHashByHeight(height + 1);
|
||||
setPrevHash(prevHashFetched);
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ class Fetch {
|
|||
}
|
||||
|
||||
static async getHashByHeight(height: number): Promise<string | null> {
|
||||
if (height === -1) return "";
|
||||
|
||||
const result = await this.getBlockDetails(height, 1);
|
||||
if (result.success === false) return null;
|
||||
if (!(result instanceof Array)) return null;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue