diff --git a/todo-app/src/App.css b/todo-app/src/App.css index 6bd3c54..a814fdd 100644 --- a/todo-app/src/App.css +++ b/todo-app/src/App.css @@ -59,7 +59,7 @@ input[placeholder] { .container { width: 40%; - height: 400px; + height: 600px; position: relative; margin: 0 auto; border-radius: 5px; diff --git a/todo-app/src/containers/TodosContainer.js b/todo-app/src/containers/TodosContainer.js index 24887d9..61774cd 100644 --- a/todo-app/src/containers/TodosContainer.js +++ b/todo-app/src/containers/TodosContainer.js @@ -27,8 +27,7 @@ class TodosContainer extends Component { updateTodo = (e, id) => { axios.put(`/api/v1/todos/${id}`, {todo: {done: e.target.checked}}) .then(response => { - const todoIndex = this.props.todos.findIndex(x => x.id === response.data.id) - this.props.dispatch(toggleTodo(todoIndex)) + this.props.dispatch(toggleTodo(id)) }) .catch(error => console.log(error)) } @@ -36,8 +35,7 @@ class TodosContainer extends Component { deleteTodo = (id) => { axios.delete(`/api/v1/todos/${id}`) .then(response => { - const todoIndex = this.props.todos.findIndex(x => x.id === id) - this.props.dispatch(deleteTodo(todoIndex)) + this.props.dispatch(deleteTodo(id)) }) .catch(error => console.log(error)) }