Get correct backend property

To detect electrum backends.
This commit is contained in:
hunicus 2025-05-13 19:31:31 -04:00
parent ce9d16f479
commit e5973b7b05
No known key found for this signature in database
GPG key ID: 24837C51B6D81FD9
2 changed files with 14 additions and 2 deletions

View file

@ -1,5 +1,7 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { Env, StateService } from '@app/services/state.service';
import { Subject, Subscription } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { restApiDocsData, wsApiDocsData } from '@app/docs/api-docs/api-docs-data';
import { faqData } from '@app/docs/api-docs/api-docs-data';
@ -13,6 +15,7 @@ export class ApiDocsNavComponent implements OnInit {
@Input() network: any;
@Input() whichTab: string;
@Output() navLinkClickEvent: EventEmitter<any> = new EventEmitter();
private destroy$: Subject<any> = new Subject<any>();
env: Env;
tabData: any[];
auditEnabled: boolean;
@ -26,7 +29,9 @@ export class ApiDocsNavComponent implements OnInit {
ngOnInit(): void {
this.env = this.stateService.env;
this.officialMempoolInstance = this.env.OFFICIAL_MEMPOOL_SPACE;
this.runningElectrs = !!(this.stateService.backend == 'esplora');
this.stateService.backend$.pipe(takeUntil(this.destroy$)).subscribe((backend) => {
this.runningElectrs = !!(backend == 'esplora');
});
this.auditEnabled = this.env.AUDIT;
if (this.whichTab === 'rest') {
this.tabData = restApiDocsData;
@ -42,4 +47,9 @@ export class ApiDocsNavComponent implements OnInit {
this.navLinkClickEvent.emit({event: event, fragment: fragment});
}
ngOnDestroy(): void {
this.destroy$.next(true);
this.destroy$.complete();
}
}

View file

@ -71,7 +71,9 @@ export class ApiDocsComponent implements OnInit, AfterViewInit {
ngOnInit(): void {
this.env = this.stateService.env;
this.officialMempoolInstance = this.env.OFFICIAL_MEMPOOL_SPACE;
this.runningElectrs = !!(this.stateService.backend == 'esplora');
this.stateService.backend$.pipe(takeUntil(this.destroy$)).subscribe((backend) => {
this.runningElectrs = !!(backend == 'esplora');
});
this.auditEnabled = this.env.AUDIT;
this.network$ = merge(of(''), this.stateService.networkChanged$).pipe(
tap((network: string) => {