Skip to content

Commit

Permalink
Implement confirmation for location removal
Browse files Browse the repository at this point in the history
  • Loading branch information
natia-cohen committed Apr 17, 2024
1 parent 7f2f235 commit ee9ae26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions js/app.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function onInit() {
}

function renderLocs(locs) {
console.log('locs', locs)
const selectedLocId = getLocIdFromQueryParams()
// console.log('locs:', locs)
var strHTML = locs.map(loc => {
Expand Down
4 changes: 3 additions & 1 deletion js/services/loc.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ function getById(locId) {
}

function remove(locId) {
return storageService.remove(DB_KEY, locId)
const removeLoc = confirm('Are you sure you want to delete the location?')
if (removeLoc) return storageService.remove(DB_KEY, locId)
return
}

function save(loc) {
Expand Down

0 comments on commit ee9ae26

Please sign in to comment.