mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 06:52:04 +00:00
refactor(api): drop apiPostList, which no capped list reads
Every capped route is read with GET, so the POST reader had no caller and failed the dead-code gate. The list-cap guard now binds a capped route to apiGetList alone, which is the reader that exists.
This commit is contained in:
1 parent
b08d527045
commit
2be262d574
3 files changed
+4
-17
No files matched your search
@@ -231,19 +231,6 @@ export async function apiGetList<T = unknown>(
|
||||
return { data, cap: readListCap(meta) };
|
||||
}
|
||||
|
||||
/** POST variant of {@link apiGetList}, for a list read with a body. */
|
||||
export async function apiPostList<T = unknown>(
|
||||
path: string,
|
||||
body?: unknown,
|
||||
init?: RequestInit,
|
||||
): Promise<{ data: T; cap: ListCap | null }> {
|
||||
const { data, meta } = await apiFetchEnvelope<T>(
|
||||
path,
|
||||
withDefaultIdempotencyKey(withJsonBody("POST", body, init)),
|
||||
);
|
||||
return { data, cap: readListCap(meta) };
|
||||
}
|
||||
|
||||
/** GET — resolves with the unwrapped `data` payload. */
|
||||
export function apiGet<T = unknown>(
|
||||
path: string,
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* reads `meta` decodes it unchanged. `truncated` is exact: true only when a
|
||||
* row past the limit exists. The OpenAPI side is `listEnvelope` in
|
||||
* `src/lib/openapi/routes/shared.ts`. A client reads it through `apiGetList`
|
||||
* / `apiPostList` (`src/lib/api/api-fetch.ts`) and shows it with
|
||||
* (`src/lib/api/api-fetch.ts`) and shows it with
|
||||
* `ListCapNotice`; `src/__tests__/list-cap-reader-guard.test.ts` binds every
|
||||
* capped route to such a reader.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user