According to Sonar lint:
Suggestion: Remove the unused function parameter "customParams" or rename it to "_customParams" for clearer intention.
However, the parameter "customParams" is actually being used in the method "getNextUrl". What am I doing wrong?
class Pagination {
private readonly maxPage: number
constructor (
private readonly data: Array<{}>,
private readonly currentPage: number,
private readonly limit: number,
private readonly count: number,
private readonly urlRoute: string,
private readonly customParams: {} = {}
) {
this.maxPage = Math.ceil(count / limit)
}
private getNextUrl (): string | null {
if (this.currentPage >= this.maxPage) {
return null
}
const query = toQueryString({
page: this.currentPage + 1,
limit: this.limit,
...this.customParams
})
return getUrl(this.urlRoute) + '?' + query
}