From c4ce2129bbb6fd4242068580b490d8d9066cb09c Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Fri, 26 Jun 2026 17:33:42 +0200 Subject: [PATCH] =?UTF-8?q?feat(collections):=20frontend=20=E2=80=94=20api?= =?UTF-8?q?.js=20updateCollection=20and=20deleteCollection=20helpers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/frontend/src/api.js b/frontend/src/api.js index 334fbf6..6b17079 100644 --- a/frontend/src/api.js +++ b/frontend/src/api.js @@ -285,6 +285,20 @@ export async function listEntryCollections(archiveId, entryUid) { return getJson(`/api/archives/${archiveId}/entries/${entryUid}/collections`); } +export async function updateCollection(archiveId, collUid, patch) { + const res = await fetch(`/api/archives/${archiveId}/collections/${collUid}`, { + method: 'PATCH', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(patch), + }) + if (!res.ok) { const e = await res.json().catch(() => ({})); throw new Error(e.error ?? res.statusText) } +} + +export async function deleteCollection(archiveId, collUid) { + const res = await fetch(`/api/archives/${archiveId}/collections/${collUid}`, { method: 'DELETE' }) + if (!res.ok) { const e = await res.json().catch(() => ({})); throw new Error(e.error ?? res.statusText) } +} + // ── 401 interceptor ─────────────────────────────────────────────────────────── const _origFetch = window.fetch; window.fetch = async (...args) => {