mirror of
https://github.com/mempool/mempool.git
synced 2026-08-20 13:28:00 +02:00
Get correct backend property
To detect electrum backends.
This commit is contained in:
parent
ce9d16f479
commit
e5973b7b05
2 changed files with 14 additions and 2 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue