This commit is contained in:
2026-11-02 20:31:15 +02:00
parent 8ddfa93f45
commit 1da273f1f3
131 changed files with 14802 additions and 526 deletions
+20 -1
View File
@@ -1,6 +1,25 @@
import { searchTerritoryHref } from './search-territory.ts';
/** Only a query string is carried; the return destination is always local. */
export function catalogueDetailHref(path: string, query: string): string {
export function catalogueDetailHref(
path: string,
query: string,
pageUrl?: string,
): string {
if (pageUrl) {
const page = new URL(
pageUrl,
'https://portal.invalid',
).searchParams.get('page');
if (
page &&
/^[1-9]\d*$/.test(page) &&
Number.isSafeInteger(Number(page))
) {
const params = new URLSearchParams(query);
params.set('page', page);
query = params.toString();
}
}
return query
? `${path}?catalogue_query=${encodeURIComponent(query)}`
: path;