Add DELETE /api/admin/backup/{filename} and delete button in Settings
This commit is contained in:
@@ -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>
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user