Show error message when the node public key does not exist

This commit is contained in:
nymkappa
2022-07-24 12:34:50 +02:00
parent 886e7e6638
commit d9e85fdcb6
2 changed files with 136 additions and 108 deletions

View File

@@ -1,7 +1,7 @@
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { ActivatedRoute, ParamMap } from '@angular/router';
import { Observable } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { catchError, map, switchMap } from 'rxjs/operators';
import { SeoService } from 'src/app/services/seo.service';
import { LightningApiService } from '../lightning-api.service';
@@ -19,6 +19,8 @@ export class NodeComponent implements OnInit {
qrCodeVisible = false;
channelsListMode = 'list';
channelsListStatus: string;
error: Error;
publicKey: string;
constructor(
private lightningApiService: LightningApiService,
@@ -30,6 +32,7 @@ export class NodeComponent implements OnInit {
this.node$ = this.activatedRoute.paramMap
.pipe(
switchMap((params: ParamMap) => {
this.publicKey = params.get('public_key');
return this.lightningApiService.getNode$(params.get('public_key'));
}),
map((node) => {
@@ -56,6 +59,13 @@ export class NodeComponent implements OnInit {
node.socketsObject = socketsObject;
return node;
}),
catchError(err => {
this.error = err;
return [{
alias: this.publicKey,
public_key: this.publicKey,
}];
})
);
}