Skip to content

Commit

Permalink
Feature/warning before delete (#177)
Browse files Browse the repository at this point in the history
* added before delete notification

* typo
  • Loading branch information
4d4mm authored Oct 23, 2018
1 parent 5b49888 commit b071b19
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/reducers/range.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ const range = (state = DEFAULT_RANGES_STATE, action) => {
const removals = {
$unset: [],
};
const deleted = [];
Object.values(state)
.sort(
(a, b) =>
Expand Down
13 changes: 11 additions & 2 deletions src/sagas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,17 @@ function* afterDelete() {
}

function* multiDelete({ selecteds }) {
for (var i = 0; i < selecteds.length; i++) {
yield put(deleteRange(selecteds[i]));
let confirmed = true;
if (selecteds.length > 1) {
confirmed = yield call(
showConfirmation,
'Multiple ranges will be deleted. Redundant length groups will be removed. Do you wish to continue?'
);
}
if (confirmed) {
for (var i = 0; i < selecteds.length; i++) {
yield put(deleteRange(selecteds[i]));
}
}
}

Expand Down

0 comments on commit b071b19

Please sign in to comment.