Use url parameter instead of query parameter
This commit is contained in:
parent
7b6246a035
commit
09f7dddf14
@ -73,12 +73,11 @@ export class BlocksList implements OnInit {
|
|||||||
this.seoService.setDescription($localize`:@@meta.description.bitcoin.blocks:See the most recent Bitcoin${seoDescriptionNetwork(this.stateService.network)} blocks along with basic stats such as block height, block reward, block size, and more.`);
|
this.seoService.setDescription($localize`:@@meta.description.bitcoin.blocks:See the most recent Bitcoin${seoDescriptionNetwork(this.stateService.network)} blocks along with basic stats such as block height, block reward, block size, and more.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.blocksCountInitializedSubscription = combineLatest([this.blocksCountInitialized$, this.route.queryParams]).pipe(
|
this.blocksCountInitializedSubscription = combineLatest([this.blocksCountInitialized$, this.route.params]).pipe(
|
||||||
filter(([blocksCountInitialized, _]) => blocksCountInitialized),
|
filter(([blocksCountInitialized, _]) => blocksCountInitialized),
|
||||||
tap(([_, params]) => {
|
tap(([_, params]) => {
|
||||||
this.page = +params['page'] || 1;
|
this.page = +params['page'] || 1;
|
||||||
this.page === 1 ? this.fromHeightSubject.next(undefined) : this.fromHeightSubject.next((this.blocksCount - 1) - (this.page - 1) * 15);
|
this.page === 1 ? this.fromHeightSubject.next(undefined) : this.fromHeightSubject.next((this.blocksCount - 1) - (this.page - 1) * 15);
|
||||||
this.cd.markForCheck();
|
|
||||||
})
|
})
|
||||||
).subscribe();
|
).subscribe();
|
||||||
|
|
||||||
@ -181,7 +180,7 @@ export class BlocksList implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pageChange(page: number): void {
|
pageChange(page: number): void {
|
||||||
this.router.navigate([], { queryParams: { page: page } });
|
this.router.navigate(['blocks', page]);
|
||||||
}
|
}
|
||||||
|
|
||||||
trackByBlock(index: number, block: BlockExtended): number {
|
trackByBlock(index: number, block: BlockExtended): number {
|
||||||
|
@ -36,7 +36,7 @@ export class RecentPegsListComponent implements OnInit {
|
|||||||
lastPegBlockUpdate: number = 0;
|
lastPegBlockUpdate: number = 0;
|
||||||
lastPegAmount: string = '';
|
lastPegAmount: string = '';
|
||||||
isLoad: boolean = true;
|
isLoad: boolean = true;
|
||||||
queryParamSubscription: Subscription;
|
paramSubscription: Subscription;
|
||||||
keyNavigationSubscription: Subscription;
|
keyNavigationSubscription: Subscription;
|
||||||
dir: 'rtl' | 'ltr' = 'ltr';
|
dir: 'rtl' | 'ltr' = 'ltr';
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ export class RecentPegsListComponent implements OnInit {
|
|||||||
this.seoService.setTitle($localize`:@@a8b0889ea1b41888f1e247f2731cc9322198ca04:Recent Peg-In / Out's`);
|
this.seoService.setTitle($localize`:@@a8b0889ea1b41888f1e247f2731cc9322198ca04:Recent Peg-In / Out's`);
|
||||||
this.websocketService.want(['blocks']);
|
this.websocketService.want(['blocks']);
|
||||||
|
|
||||||
this.queryParamSubscription = this.route.queryParams.pipe(
|
this.paramSubscription = this.route.params.pipe(
|
||||||
tap((params) => {
|
tap((params) => {
|
||||||
this.page = +params['page'] || 1;
|
this.page = +params['page'] || 1;
|
||||||
this.startingIndexSubject.next((this.page - 1) * 15);
|
this.startingIndexSubject.next((this.page - 1) * 15);
|
||||||
@ -173,12 +173,12 @@ export class RecentPegsListComponent implements OnInit {
|
|||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.destroy$.next(1);
|
this.destroy$.next(1);
|
||||||
this.destroy$.complete();
|
this.destroy$.complete();
|
||||||
this.queryParamSubscription?.unsubscribe();
|
this.paramSubscription?.unsubscribe();
|
||||||
this.keyNavigationSubscription?.unsubscribe();
|
this.keyNavigationSubscription?.unsubscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
pageChange(page: number): void {
|
pageChange(page: number): void {
|
||||||
this.router.navigate([], { queryParams: { page: page } });
|
this.router.navigate(['audit', 'pegs', page]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -84,10 +84,14 @@ const routes: Routes = [
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'audit/pegs',
|
path: 'audit/pegs/:page',
|
||||||
data: { networks: ['liquid'] },
|
data: { networks: ['liquid'] },
|
||||||
component: RecentPegsListComponent,
|
component: RecentPegsListComponent,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'audit/pegs',
|
||||||
|
redirectTo: 'audit/pegs/1'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'assets',
|
path: 'assets',
|
||||||
data: { networks: ['liquid'] },
|
data: { networks: ['liquid'] },
|
||||||
|
@ -45,9 +45,13 @@ const routes: Routes = [
|
|||||||
loadChildren: () => import('./components/about/about.module').then(m => m.AboutModule),
|
loadChildren: () => import('./components/about/about.module').then(m => m.AboutModule),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'blocks',
|
path: 'blocks/:page',
|
||||||
component: BlocksList,
|
component: BlocksList,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'blocks',
|
||||||
|
redirectTo: 'blocks/1',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'rbf',
|
path: 'rbf',
|
||||||
component: RbfList,
|
component: RbfList,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user