Use a type check instead of a default value for maxLimit

This commit is contained in:
Alexandre Bodin 2023-09-15 18:44:25 +02:00
parent bac1fb9210
commit 9ffe97a2ab

View File

@ -105,8 +105,10 @@ const getPaginationInfo = (params: { pagination?: PaginationParams }): Paginatio
return { return {
page: Math.max(1, toNumber(pagination.page || 1)), page: Math.max(1, toNumber(pagination.page || 1)),
pageSize: shouldApplyMaxLimit(pageSize, maxLimit, { isPagedPagination: true }) pageSize:
? maxLimit ?? 1 typeof maxLimit === 'number' &&
shouldApplyMaxLimit(pageSize, maxLimit, { isPagedPagination: true })
? maxLimit
: Math.max(1, pageSize), : Math.max(1, pageSize),
}; };
} }