Skip to content

Commit

Permalink
Merge pull request #5 from iamsjunaid/add-edit-functionality
Browse files Browse the repository at this point in the history
fix bug on for editing task
  • Loading branch information
iamsjunaid committed May 8, 2023
2 parents 3a4899c + 6b12011 commit ce68809
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions dist/index.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ const renderTaskList = () => {

const clearCompletedTasks = () => {
tasks = tasks.filter((item) => !item.completed);
tasks.map((task, index) => {
task.index = index + 1;
return task;
let i = 0;
tasks.forEach((task) => {
task.index = i;
i += 1;
});
saveTasks();
renderTaskList();
Expand Down
7 changes: 4 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ export const renderTaskList = () => {

const clearCompletedTasks = () => {
tasks = tasks.filter((item) => !item.completed);
tasks.map((task, index) => {
task.index = index + 1;
return task;
let i = 0;
tasks.forEach((task) => {
task.index = i;
i += 1;
});
saveTasks();
renderTaskList();
Expand Down

0 comments on commit ce68809

Please sign in to comment.