Added confirm before object removal
This commit is contained in:
@@ -49,14 +49,21 @@ export const Bucket = () => {
|
||||
}
|
||||
|
||||
const deleteObject = async id => {
|
||||
if (!confirm(`Cancellare l'oggetto con id ${id} da questo bucket?`)) {
|
||||
showToast(<ToastMessage icon="info">Operazione annullata</ToastMessage>)
|
||||
return
|
||||
}
|
||||
|
||||
const res = await fetch(`/api/buckets/${bucket}/${id}`, { method: 'DELETE' })
|
||||
|
||||
if (res.ok) {
|
||||
showToast('Oggetto rimosso')
|
||||
showToast(<ToastMessage icon="info">Oggetto rimosso</ToastMessage>)
|
||||
|
||||
await updateBucketObjects()
|
||||
} else {
|
||||
showToast(`Errore "${await res.text()}"`)
|
||||
showToast(
|
||||
<ToastMessage icon="error">Errore del server "{await res.text()}"</ToastMessage>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user