From 9de50bc2063c05c14f4c4fccb6171d51fb39fd95 Mon Sep 17 00:00:00 2001 From: Axel Pettersson Date: Sat, 30 Sep 2023 14:26:25 +0200 Subject: [PATCH] Refactor member document query --- apps/web/lib/api/documents/get-member-documents.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/web/lib/api/documents/get-member-documents.ts b/apps/web/lib/api/documents/get-member-documents.ts index 9df4302b3..4bd7519e5 100644 --- a/apps/web/lib/api/documents/get-member-documents.ts +++ b/apps/web/lib/api/documents/get-member-documents.ts @@ -7,8 +7,17 @@ interface Query { } export default async function getMemberDocuments({ id, page }: Query) { + const query = new URLSearchParams({ + iid: id, + p: page.toString(), + avd: "dokument", + sort: "datum", + sortorder: "datum", + utformat: "json", + }); + const response = await fetch( - `${PARLIAMENT_BASE_URL}/dokumentlista/?avd=dokument&sort=datum&sortorder=datum&utformat=json&iid=${id}&p=${page}`, + `${PARLIAMENT_BASE_URL}/dokumentlista/?${query}`, { next: { revalidate: 60 * 60 * 24 } }, ); const data = await response.json();