From fd428ac41b9ace5d5ff08153077d65e2d6997fd0 Mon Sep 17 00:00:00 2001 From: cfdaily Date: Wed, 20 May 2026 22:16:03 +0800 Subject: [PATCH] auto-sync: 2026-05-20 22:16:03 --- src/frontend/src/components/EdictBoard.tsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/frontend/src/components/EdictBoard.tsx b/src/frontend/src/components/EdictBoard.tsx index a299f45..61fc9df 100644 --- a/src/frontend/src/components/EdictBoard.tsx +++ b/src/frontend/src/components/EdictBoard.tsx @@ -346,16 +346,15 @@ export default function EdictBoard() { if (!showProjectConfirm) return; const { id, action } = showProjectConfirm; try { - const res = await fetch(`/api/projects/${id}`, { - method: action === 'archive' ? 'POST' : 'DELETE', - ...(action === 'archive' ? {} : {}), - }); + let ok = false; if (action === 'archive') { - // archive 走专用端点 - const res2 = await fetch(`/api/projects/${id}/archive`, { method: 'POST' }); - if (!res2.ok) { toast('归档失败', 'err'); return; } + const res = await fetch(`/api/projects/${id}/archive`, { method: 'POST' }); + ok = res.ok; + } else { + const res = await fetch(`/api/projects/${id}`, { method: 'DELETE' }); + ok = res.ok; } - if (res.ok) { + if (ok) { toast(action === 'archive' ? `📦 已归档 ${id}` : `🗑️ 已删除 ${id}`); setSelectedProjectId(''); loadLive();