Fix pagination URL generation in ModsList

This commit is contained in:
wysh 2025-02-01 03:05:54 +05:30 committed by GitHub
parent 1fa3bcbbda
commit 626f00b235
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -72,17 +72,16 @@ export default function ModsList({ mods }: ModsListProps) {
}
function getPageUrl(pageNum: number) {
let link = '/mods'
const params = new URLSearchParams(searchParams)
if (pageNum > 1) {
link += `?page=${pageNum}`
params.set('page', pageNum.toString())
} else {
params.delete('page')
}
if (searchParams) {
link += `&${searchParams.toString()}`
}
return link
const queryString = params.toString()
return `/mods${queryString ? `?${queryString}` : ''}`
}
function renderPagination() {