Commit 2684630c authored by Marcos Barrera's avatar Marcos Barrera

Replace error param with a 'isInactive' boolean param

Use a 'isInactive' boolean param instead of the current error param to
check whether the current row state is inactive or not.
parent 2a0e3b27
Pipeline #27153811 passed with stages
in 96 minutes and 8 seconds
......@@ -69,13 +69,13 @@ export default class Todos {
.then(({ data }) => {
this.updateRowState(target);
this.updateBadges(data);
}).catch(err => {
this.updateRowState(target, err);
}).catch(() => {
this.updateRowState(target, true);
return flash(__('Error updating todo status.'));
});
}
updateRowState(target, error = null) {
updateRowState(target, isInactive = false) {
const row = target.closest('li');
const restoreBtn = row.querySelector('.js-undo-todo');
const doneBtn = row.querySelector('.js-done-todo');
......@@ -84,7 +84,7 @@ export default class Todos {
target.removeAttribute('disabled');
target.classList.remove('disabled');
if (error !== null) {
if (isInactive === true) {
restoreBtn.classList.add('hidden');
doneBtn.classList.remove('hidden');
} else if (target === doneBtn) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment