From 86f0942194de003405b4513b83bd554ac4a30d3e Mon Sep 17 00:00:00 2001 From: HYOJIN Date: Wed, 25 Mar 2026 08:40:06 +0900 Subject: [PATCH] =?UTF-8?q?fix(schedule):=20=EC=8A=A4=EC=BC=80=EC=A4=84=20?= =?UTF-8?q?toggle=20API=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EB=B6=88=EC=9D=BC?= =?UTF-8?q?=EC=B9=98=20=EC=88=98=EC=A0=95=20(#6)=20(#8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/batchApi.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/frontend/src/api/batchApi.ts b/frontend/src/api/batchApi.ts index 03b247e..05d0845 100644 --- a/frontend/src/api/batchApi.ts +++ b/frontend/src/api/batchApi.ts @@ -26,6 +26,16 @@ async function putJson(url: string, body?: unknown): Promise { return res.json(); } +async function patchJson(url: string, body?: unknown): Promise { + const res = await fetch(url, { + method: 'PATCH', + headers: { 'Content-Type': 'application/json' }, + body: body ? JSON.stringify(body) : undefined, + }); + if (!res.ok) throw new Error(`API Error: ${res.status} ${res.statusText}`); + return res.json(); +} + async function deleteJson(url: string): Promise { const res = await fetch(url, { method: 'DELETE' }); if (!res.ok) throw new Error(`API Error: ${res.status} ${res.statusText}`); @@ -400,7 +410,7 @@ export const batchApi = { deleteJson<{ success: boolean; message: string }>(`${BASE}/schedules/${jobName}`), toggleSchedule: (jobName: string, active: boolean) => - postJson<{ success: boolean; message: string; data?: ScheduleResponse }>( + patchJson<{ success: boolean; message: string; data?: ScheduleResponse }>( `${BASE}/schedules/${jobName}/toggle`, { active }), // Timeline