удалила лишние строки

parent d8ebe16e
...@@ -153,6 +153,20 @@ export default function EnhancedTable() { ...@@ -153,6 +153,20 @@ export default function EnhancedTable() {
}); });
}; };
const onToggleEditModeDone = id => {
if (readOnly==true) {setReadOnly(false)} else {setReadOnly(true)}
setTasks(state => {
return tasks.map(task => {
if (task.id === id) {
React.dispatch(addTask(task))
return { ...task, isEditMode: !task.isEditMode };
}
return task;
});
});
};
const onChange = (e, task) => { const onChange = (e, task) => {
const value = e.target.value; const value = e.target.value;
const name = e.target.name; const name = e.target.name;
...@@ -216,7 +230,8 @@ export default function EnhancedTable() { ...@@ -216,7 +230,8 @@ export default function EnhancedTable() {
accomplish:" " accomplish:" "
} }
) )
setTasks(newTasks) setTasks(newTasks);
}; };
return ( return (
...@@ -292,7 +307,7 @@ export default function EnhancedTable() { ...@@ -292,7 +307,7 @@ export default function EnhancedTable() {
<IconButton <IconButton
aria-label="done" aria-label="done"
onClick={() => onToggleEditMode(task.id)} onClick={() => onToggleEditModeDone(task.id)}
> >
<Done/> <Done/>
</IconButton> </IconButton>
......
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