Skip to content

Commit

Permalink
Make user confirm admin actions (#82)
Browse files Browse the repository at this point in the history
Closes #54
  • Loading branch information
hmellor authored Jun 7, 2024
1 parent 67da1cb commit f122b72
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/firebase/utils.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ export const editItems = (id = undefined, updateItems = false, deleteBids = fals
// If ID was provided, place that item in an array by itself
if (id !== undefined) items = [items.find((item) => item.id === id)];

// Make the user confirm they want to edit items
let action = updateItems? 'update item data' : (deleteBids ? 'delete all bids' : '');
let item = id === undefined ? 'all items' : `item ${id}`;
if (confirm(`You are about to ${action} for ${item}, are you sure?`) == false) {
return
}

const docRef = doc(db, "auction", "items");
getDoc(docRef)
.then((doc) => {
Expand Down

0 comments on commit f122b72

Please sign in to comment.