You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
5 years ago
|
import { Component, OnInit, Input } from '@angular/core';
|
||
6 years ago
|
import { Subject } from 'rxjs';
|
||
|
import { takeUntil } from 'rxjs/operators';
|
||
|
import { Store } from '@ngrx/store';
|
||
|
|
||
3 years ago
|
import { ChannelEdge, GetInfo } from '../../../../shared/models/lndModels';
|
||
|
import { RTLState } from '../../../../store/rtl.state';
|
||
|
import { lndNodeInformation } from '../../../store/lnd.selector';
|
||
6 years ago
|
|
||
|
@Component({
|
||
|
selector: 'rtl-channel-lookup',
|
||
|
templateUrl: './channel-lookup.component.html',
|
||
5 years ago
|
styleUrls: ['./channel-lookup.component.scss']
|
||
6 years ago
|
})
|
||
5 years ago
|
export class ChannelLookupComponent implements OnInit {
|
||
3 years ago
|
|
||
6 years ago
|
@Input() lookupResult: ChannelEdge;
|
||
|
public node1_match = false;
|
||
|
public node2_match = false;
|
||
5 years ago
|
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
|
||
6 years ago
|
|
||
3 years ago
|
constructor(private store: Store<RTLState>) { }
|
||
6 years ago
|
|
||
|
ngOnInit() {
|
||
3 years ago
|
this.store.select(lndNodeInformation).pipe(takeUntil(this.unSubs[0])).subscribe((nodeInfo: GetInfo) => {
|
||
|
if (this.lookupResult.node1_pub === nodeInfo.identity_pubkey) {
|
||
|
this.node1_match = true;
|
||
|
}
|
||
|
if (this.lookupResult.node2_pub === nodeInfo.identity_pubkey) {
|
||
|
this.node2_match = true;
|
||
|
}
|
||
|
});
|
||
6 years ago
|
}
|
||
|
|
||
|
}
|