From 81e2263a090aae7fe9490ba80cfbf53ec7e9c38d Mon Sep 17 00:00:00 2001 From: Antonio De Lucreziis Date: Thu, 7 Jul 2022 18:40:17 +0200 Subject: [PATCH] Added confirm before object removal --- _frontend/src/pages/Bucket.jsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/_frontend/src/pages/Bucket.jsx b/_frontend/src/pages/Bucket.jsx index f65edda..8c2b8d1 100644 --- a/_frontend/src/pages/Bucket.jsx +++ b/_frontend/src/pages/Bucket.jsx @@ -49,14 +49,21 @@ export const Bucket = () => { } const deleteObject = async id => { + if (!confirm(`Cancellare l'oggetto con id ${id} da questo bucket?`)) { + showToast(Operazione annullata) + return + } + const res = await fetch(`/api/buckets/${bucket}/${id}`, { method: 'DELETE' }) if (res.ok) { - showToast('Oggetto rimosso') + showToast(Oggetto rimosso) await updateBucketObjects() } else { - showToast(`Errore "${await res.text()}"`) + showToast( + Errore del server "{await res.text()}" + ) } }