refactor latest-activity in progress

*added keyword info on url
This commit is contained in:
Sofia Papacharalampous 2024-05-23 15:45:49 +03:00
parent b36622334a
commit 4aba8edf23
1 changed files with 11 additions and 1 deletions

View File

@ -117,6 +117,14 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
}
updateUrl() {
// let parameters = "" +
// (this.page != 1 ? "&page=" + this.page : "") +
// //TODO refactor
// // (((this.formGroup.get("order").value != this.order.UpdatedAt && !this.publicMode) || (this.formGroup.get("order").value != this.order.Published && this.publicMode)) ? "&order=" + this.formGroup.get("order").value : "") +
// (this.formGroup.get("like").value ? ("&keyword=" + this.formGroup.get("like").value) : "");
// this.location.go(this.router.url.split('?')[0] + parameters);
let parametersArray: string[] = [
...(this.currentPage > 1 ? ["page=" + this.currentPage] : []),
...(this.formGroup.get("like").value ? ["&keyword=" + this.formGroup.get("like").value] : [])
@ -148,7 +156,8 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
]
};
this.loadMore({ size: this.pageSize*this.currentPage, offset: 0 }, false);
const initItems = this.currentPage == 0;
this.loadMore({ size: initItems ? this.pageSize : this.pageSize*this.currentPage, offset: 0 }, initItems);
}
loadMore(page?: Lookup.Paging, updatePage: boolean = true) {
@ -195,6 +204,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
})
if (updatePage && response.length > 0 && this.listingItems.length >= this.currentPage*this.pageSize) this._setPage(this.currentPage+1);
else this.updateUrl();
});
}