Add DELETE /api/admin/backup/{filename} and delete button in Settings

This commit is contained in:
IT狗
2026-07-21 13:14:56 +08:00
parent e531cea8a4
commit c1b1d6f35b
2 changed files with 29 additions and 0 deletions
+16
View File
@@ -218,6 +218,22 @@ export default function Settings() {
>
<Upload className="w-3.5 h-3.5" /> 還原
</button>
<button
onClick={async () => {
if (!confirm(`確定要刪除 ${b.filename}`)) return
try {
await api.delete(`/api/admin/backup/${b.filename}`)
toast.success(`已刪除 ${b.filename}`)
fetchBackups()
} catch (e) {
toast.error("刪除失敗: " + (e.response?.data?.detail || e.message))
}
}}
className="flex items-center gap-1 px-3 py-1.5 text-xs font-medium text-red-500 hover:text-red-700 hover:bg-red-50 rounded-md transition-colors"
title="Delete backup"
>
<Trash2 className="w-3.5 h-3.5" /> 刪除
</button>
</div>
</div>
))