Skip to content

Commit

Permalink
Fix pagination in activity listing
Browse files Browse the repository at this point in the history
  • Loading branch information
jvyden committed May 23, 2024
1 parent ad19fc0 commit 410ab06
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/app/pages/activity-listing/activity-listing.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,21 @@ export class ActivityListingComponent implements Scrollable {
isLoading: boolean = false;
listInfo: RefreshApiListInfo = defaultListInfo;

pagesCount: number = 0;
pageSize: number = 20;

loadData(): void {
this.isLoading = true;
this.client.getActivityPage(this.listInfo.nextPageIndex, 20).subscribe(page => {
this.client.getActivityPage(this.listInfo.nextPageIndex, this.pageSize).subscribe(page => {
this.isLoading = false;
this.listInfo.nextPageIndex += page.events.length + 1;

this.listInfo = {
nextPageIndex: (this.pagesCount * this.pageSize) + page.events.length + 1,
totalItems: -1
};

this.pages.push(page);
this.pagesCount++;
});
}
}

0 comments on commit 410ab06

Please sign in to comment.