fix(schedule): 스케줄 toggle API 메서드 불일치 수정 (#6)
Backend @PatchMapping에 맞춰 Frontend toggleSchedule을 POST → PATCH로 변경 patchJson 헬퍼 함수 추가 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
부모
c3beb65942
커밋
614a4af16a
@ -26,6 +26,16 @@ async function putJson<T>(url: string, body?: unknown): Promise<T> {
|
||||
return res.json();
|
||||
}
|
||||
|
||||
async function patchJson<T>(url: string, body?: unknown): Promise<T> {
|
||||
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<T>(url: string): Promise<T> {
|
||||
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
|
||||
|
||||
불러오는 중...
Reference in New Issue
Block a user