Pagination fixes.
This commit is contained in:
		
							parent
							
								
									097e2ba0ea
								
							
						
					
					
						commit
						71c44d725a
					
				| @ -1,4 +1,4 @@ | ||||
| import { Component, OnInit, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'; | ||||
| import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core'; | ||||
| import { AssetsService } from '../services/assets.service'; | ||||
| import { environment } from 'src/environments/environment'; | ||||
| import { FormGroup, FormBuilder, Validators } from '@angular/forms'; | ||||
| @ -32,7 +32,6 @@ export class AssetsComponent implements OnInit { | ||||
|     private formBuilder: FormBuilder, | ||||
|     private route: ActivatedRoute, | ||||
|     private router: Router, | ||||
|     private cd: ChangeDetectorRef, | ||||
|   ) { } | ||||
| 
 | ||||
|   ngOnInit() { | ||||
| @ -89,7 +88,6 @@ export class AssetsComponent implements OnInit { | ||||
|                 } else { | ||||
|                   this.page = 1; | ||||
|                 } | ||||
|                 this.cd.markForCheck(); | ||||
|                 if (this.searchForm.get('searchText').value !== (queryParams.search || '')) { | ||||
|                   this.searchTextChanged(queryParams.search); | ||||
|                 } | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| import { Component, OnInit, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'; | ||||
| import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core'; | ||||
| import { BisqApiService } from '../bisq-api.service'; | ||||
| import { switchMap, map } from 'rxjs/operators'; | ||||
| import { switchMap, map, take, mergeMap, tap } from 'rxjs/operators'; | ||||
| import { Observable } from 'rxjs'; | ||||
| import { BisqBlock, BisqOutput, BisqTransaction } from '../bisq.interfaces'; | ||||
| import { SeoService } from 'src/app/services/seo.service'; | ||||
| @ -29,7 +29,6 @@ export class BisqBlocksComponent implements OnInit { | ||||
|     private seoService: SeoService, | ||||
|     private route: ActivatedRoute, | ||||
|     private router: Router, | ||||
|     private cd: ChangeDetectorRef, | ||||
|   ) { } | ||||
| 
 | ||||
|   ngOnInit(): void { | ||||
| @ -43,12 +42,20 @@ export class BisqBlocksComponent implements OnInit { | ||||
| 
 | ||||
|     this.blocks$ = this.route.queryParams | ||||
|       .pipe( | ||||
|         take(1), | ||||
|         tap((qp) => { | ||||
|           if (qp.page) { | ||||
|             this.page = parseInt(qp.page, 10); | ||||
|           } | ||||
|         }), | ||||
|         mergeMap(() => this.route.queryParams), | ||||
|         map((queryParams) => { | ||||
|           if (queryParams.page) { | ||||
|             const newPage = parseInt(queryParams.page, 10); | ||||
|             this.page = newPage; | ||||
|             this.cd.markForCheck(); | ||||
|             return newPage; | ||||
|           } else { | ||||
|             this.page = 1; | ||||
|           } | ||||
|           return 1; | ||||
|         }), | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import { Component, OnInit, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'; | ||||
| import { BisqTransaction, BisqOutput } from '../bisq.interfaces'; | ||||
| 
 | ||||
| import { merge, Observable, Subject } from 'rxjs'; | ||||
| import { merge, Observable } from 'rxjs'; | ||||
| import { switchMap, map, tap, filter } from 'rxjs/operators'; | ||||
| import { BisqApiService } from '../bisq-api.service'; | ||||
| import { SeoService } from 'src/app/services/seo.service'; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user