Fixes category in lists

This commit is contained in:
Christian Beutel
2025-08-24 14:16:36 +02:00
parent 7f82509f3d
commit 7596a916f8

View File

@@ -79,7 +79,7 @@ export async function lists_search_filter(filter: ListFilter, page: number = 1,
export async function lists_show(id: string, handle?: string, f: (url: RequestInfo | URL, config?: RequestInit) => Promise<Response> = fetch) { export async function lists_show(id: string, handle?: string, f: (url: RequestInfo | URL, config?: RequestInit) => Promise<Response> = fetch) {
const r = await f(`/api/v1/list/${id}?` + new URLSearchParams({ const r = await f(`/api/v1/list/${id}?` + new URLSearchParams({
expand: "author,trails,trails.author,list_share_via_list.actor", expand: "author,trails,trails.author,trails.category,list_share_via_list.actor",
...(handle ? { handle } : {}) ...(handle ? { handle } : {})
}), { }), {
method: 'GET', method: 'GET',
@@ -95,6 +95,7 @@ export async function lists_show(id: string, handle?: string, f: (url: RequestIn
for (const trail of response.expand?.trails ?? []) { for (const trail of response.expand?.trails ?? []) {
const gpxData: string = await fetchGPX(trail, f); const gpxData: string = await fetchGPX(trail, f);
trail.expand.gpx_data = gpxData; trail.expand.gpx_data = gpxData;
trail.category = trail.expand?.category?.name ?? "-";
} }
list.set(response); list.set(response);