|
@@ -96,13 +96,19 @@ function loadData(toArray) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function deleteData(id) {
|
|
|
+async function deleteData(id) {
|
|
|
// If card in local storage remove
|
|
|
if (localStorage[id]) {
|
|
|
- localStorage.removeItem(id);
|
|
|
- let list = JSON.parse(localStorage.list);
|
|
|
- list.removeItem(id);
|
|
|
- localStorage.setItem('list', JSON.stringify(list));
|
|
|
+ const data = JSON.parse(localStorage[id]);
|
|
|
+ if (await func.confirmDelete(data.title)) {
|
|
|
+ localStorage.removeItem(id);
|
|
|
+ let list = JSON.parse(localStorage.list);
|
|
|
+ list.removeItem(id);
|
|
|
+ localStorage.setItem('list', JSON.stringify(list));
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|