mempool/frontend/src/app/lightning/channel/channel.component.ts

34 lines
1.0 KiB
TypeScript
Raw Normal View History

2022-05-01 03:01:27 +04:00
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { ActivatedRoute, ParamMap } from '@angular/router';
import { Observable } from 'rxjs';
import { switchMap } from 'rxjs/operators';
2022-05-15 19:22:14 +04:00
import { SeoService } from 'src/app/services/seo.service';
2022-05-01 03:01:27 +04:00
import { LightningApiService } from '../lightning-api.service';
@Component({
selector: 'app-channel',
templateUrl: './channel.component.html',
styleUrls: ['./channel.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ChannelComponent implements OnInit {
channel$: Observable<any>;
constructor(
private lightningApiService: LightningApiService,
private activatedRoute: ActivatedRoute,
2022-05-15 19:22:14 +04:00
private seoService: SeoService,
2022-05-01 03:01:27 +04:00
) { }
ngOnInit(): void {
this.channel$ = this.activatedRoute.paramMap
.pipe(
switchMap((params: ParamMap) => {
2022-05-15 19:22:14 +04:00
this.seoService.setTitle(`Channel: ${params.get('short_id')}`);
2022-05-01 03:01:27 +04:00
return this.lightningApiService.getChannel$(params.get('short_id'));
})
);
}
}