Adding missing error output on /blocks page.
This commit is contained in:
parent
9689ccf2ac
commit
e36646ac7c
@ -46,4 +46,12 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<ng-template [ngIf]="error">
|
||||||
|
<div class="text-center">
|
||||||
|
<span>Error loading blocks</span>
|
||||||
|
<br>
|
||||||
|
<i>{{ error.error }}</i>
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,7 +15,7 @@ import { map } from 'rxjs/operators';
|
|||||||
})
|
})
|
||||||
export class LatestBlocksComponent implements OnInit, OnDestroy {
|
export class LatestBlocksComponent implements OnInit, OnDestroy {
|
||||||
network$: Observable<string>;
|
network$: Observable<string>;
|
||||||
|
error: any;
|
||||||
blocks: any[] = [];
|
blocks: any[] = [];
|
||||||
blockSubscription: Subscription;
|
blockSubscription: Subscription;
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
@ -86,6 +86,7 @@ export class LatestBlocksComponent implements OnInit, OnDestroy {
|
|||||||
.subscribe((blocks) => {
|
.subscribe((blocks) => {
|
||||||
this.blocks = blocks;
|
this.blocks = blocks;
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
|
this.error = undefined;
|
||||||
|
|
||||||
this.latestBlockHeight = blocks[0].height;
|
this.latestBlockHeight = blocks[0].height;
|
||||||
|
|
||||||
@ -95,6 +96,12 @@ export class LatestBlocksComponent implements OnInit, OnDestroy {
|
|||||||
this.loadMore(chunks);
|
this.loadMore(chunks);
|
||||||
}
|
}
|
||||||
this.cd.markForCheck();
|
this.cd.markForCheck();
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
console.log(error);
|
||||||
|
this.error = error;
|
||||||
|
this.isLoading = false;
|
||||||
|
this.cd.markForCheck();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,12 +114,19 @@ export class LatestBlocksComponent implements OnInit, OnDestroy {
|
|||||||
.subscribe((blocks) => {
|
.subscribe((blocks) => {
|
||||||
this.blocks = this.blocks.concat(blocks);
|
this.blocks = this.blocks.concat(blocks);
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
|
this.error = undefined;
|
||||||
|
|
||||||
const chunksLeft = chunks - 1;
|
const chunksLeft = chunks - 1;
|
||||||
if (chunksLeft > 0) {
|
if (chunksLeft > 0) {
|
||||||
this.loadMore(chunksLeft);
|
this.loadMore(chunksLeft);
|
||||||
}
|
}
|
||||||
this.cd.markForCheck();
|
this.cd.markForCheck();
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
console.log(error);
|
||||||
|
this.error = error;
|
||||||
|
this.isLoading = false;
|
||||||
|
this.cd.markForCheck();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user