diff --git a/src/components/ListItem.jsx b/src/components/ListItem.jsx index fb5d6ba..942aed9 100644 --- a/src/components/ListItem.jsx +++ b/src/components/ListItem.jsx @@ -13,6 +13,7 @@ const ListItem = ({list}) => { // } + const listHandler = (name) => () => { dispatch(activeListActions.updateActiveList(name)) } diff --git a/src/components/TasksForm.jsx b/src/components/TasksForm.jsx index 315e1ca..e8465c9 100644 --- a/src/components/TasksForm.jsx +++ b/src/components/TasksForm.jsx @@ -4,16 +4,25 @@ import { actions as tasksActions} from "../slices/tasksSlice"; import uniqueId from 'lodash/uniqueId' const TasksForm = () => { - const [value, setValue] = useState('') + const [data, setValue] = useState({ + task: '', + description: '' + }) - const onChange = (e) => setValue(e.target.value) + const taskHandler = (e) => setValue({...data, task: e.target.value}) + const descriptionHandler = (e) => setValue({...data, description: e.target.value}) const dispatch = useDispatch() const activeList = useSelector(state => state.activeList.value) - + console.log(data) const submitHandler = (e) => { + console.log(data) e.preventDefault() - dispatch(tasksActions.addTask({ name: value, id: uniqueId(), completed: false, list: activeList})) - setValue('') + dispatch(tasksActions.addTask({ name: data.task, description: data.description, id: uniqueId(), completed: false, list: activeList})) + setValue({ + task: '', + description: '' + }) + console.log(data) } @@ -24,7 +33,11 @@ const TasksForm = () => {
{task.name}
+ {(task.description !== '') ? {task.description} : null} +