bugfix + patch

- fix update function
- added patch
This commit is contained in:
cv
2021-04-10 16:32:57 +02:00
parent ba8274819e
commit 85de94e077
3 changed files with 80 additions and 51 deletions
@@ -18,7 +18,7 @@ import { showErrorToast } from '../../../common/helpers/toastManager';
import style from './List.module.css';
export default function EventListItem(props) {
const { data, selected, delay, index, eventsHandler, updateData } = props;
const { data, selected, delay, index, eventsHandler } = props;
const [more, setMore] = useState(false);
const [timeStart, setTimeStart] = useState(0);
@@ -34,10 +34,10 @@ export default function EventListItem(props) {
// validate field
if (field in data) {
// create object with new field
const newData = { ...data, [field]: value };
const newData = { id: data.id, [field]: value };
// request update in parent
updateData(index, newData);
eventsHandler('patch', newData);
} else {
showErrorToast('Field Error: ' + field);
}