diff --git a/frontend/src/lib/api/zaken.ts b/frontend/src/lib/api/zaken.ts index 081c92cf..009a93c5 100644 --- a/frontend/src/lib/api/zaken.ts +++ b/frontend/src/lib/api/zaken.ts @@ -8,7 +8,19 @@ export type PaginatedZaken = PaginatedResults; * Retrieve zaken using the configured ZRC service. For information over the query parameters accepted and the schema of * the response, look at the '/zaken/api/v1/zaken' list endpoint of Open Zaak. */ -export async function listZaken(params?: Record) { +export async function listZaken( + params?: URLSearchParams | Record, +) { + const response = await request("GET", "/zaken/", params); + const promise: Promise = response.json(); + return promise; +} + +/** + * Search zaken using the configured ZRC service. For information over the filters that can be passed in the + * request body, look at query params of the '/zaken/api/v1/zaken' list endpoint of Open Zaak. + */ +export async function searchZaken(params?: Record) { const response = await request( "POST", "/zaken/search/", diff --git a/frontend/src/pages/destructionlist/create/DestructionListCreate.loader.ts b/frontend/src/pages/destructionlist/create/DestructionListCreate.loader.ts index cde8f625..6502e9a1 100644 --- a/frontend/src/pages/destructionlist/create/DestructionListCreate.loader.ts +++ b/frontend/src/pages/destructionlist/create/DestructionListCreate.loader.ts @@ -2,7 +2,7 @@ import { LoaderFunctionArgs } from "@remix-run/router/utils"; import { User } from "../../../lib/api/auth"; import { listReviewers } from "../../../lib/api/reviewers"; -import { PaginatedZaken, listZaken } from "../../../lib/api/zaken"; +import { PaginatedZaken, searchZaken } from "../../../lib/api/zaken"; import { canStartDestructionListRequired, loginRequired, @@ -35,7 +35,7 @@ export const destructionListCreateLoader = loginRequired( // Fetch reviewers, zaken, and choices concurrently const [zaken, reviewers] = await Promise.all([ - listZaken(searchParamsZakenEndpoint), + searchZaken(searchParamsZakenEndpoint), listReviewers(), ]);