Avoid sending duplicate PUT requests when toggling completion

This commit is contained in:
Ivan Deskov 2020-05-24 00:13:24 +01:00
parent 6d6a950908
commit 1874dc4724
1 changed files with 2 additions and 1 deletions

View File

@ -117,7 +117,8 @@ function AddItemForm({ onNewItem }) {
function ItemDisplay({ item, onItemUpdate, onItemRemoval }) {
const { Container, Row, Col, Button } = ReactBootstrap;
const toggleCompletion = () => {
const toggleCompletion = (event) => {
event.stopPropagation()
fetch(`/items/${item.id}`, {
method: 'PUT',
body: JSON.stringify({