aboutsummaryrefslogtreecommitdiff
path: root/modern/src/settings/AccumulatorsPage.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-04 17:12:00 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-04 17:12:00 -0700
commitf559ae8d2f9c4a9bc5f450faa749a8ce13645fdd (patch)
tree91511c6800e6fba8ba837a43190d89b46ea6edd2 /modern/src/settings/AccumulatorsPage.js
parentebbf533b5f8bae16a946852fccef397e4bbe8f7d (diff)
downloadtrackermap-web-f559ae8d2f9c4a9bc5f450faa749a8ce13645fdd.tar.gz
trackermap-web-f559ae8d2f9c4a9bc5f450faa749a8ce13645fdd.tar.bz2
trackermap-web-f559ae8d2f9c4a9bc5f450faa749a8ce13645fdd.zip
Implement send commands
Diffstat (limited to 'modern/src/settings/AccumulatorsPage.js')
-rw-r--r--modern/src/settings/AccumulatorsPage.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/modern/src/settings/AccumulatorsPage.js b/modern/src/settings/AccumulatorsPage.js
index f592445d..3e98612a 100644
--- a/modern/src/settings/AccumulatorsPage.js
+++ b/modern/src/settings/AccumulatorsPage.js
@@ -29,23 +29,23 @@ const AccumulatorsPage = () => {
const classes = useStyles();
const t = useTranslation();
- const { id } = useParams();
- const position = useSelector((state) => state.positions.items[id]);
+ const { deviceId } = useParams();
+ const position = useSelector((state) => state.positions.items[deviceId]);
const [item, setItem] = useState();
useEffect(() => {
if (position) {
setItem({
- deviceId: parseInt(id, 10),
+ deviceId: parseInt(deviceId, 10),
hours: position.attributes.hours || 0,
totalDistance: position.attributes.totalDistance || 0,
});
}
- }, [id, position]);
+ }, [deviceId, position]);
const handleSave = async () => {
- const response = await fetch(`/api/devices/${id}/accumulators`, {
+ const response = await fetch(`/api/devices/${deviceId}/accumulators`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(item),