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