aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modern/src/CommandsPage.js7
-rw-r--r--modern/src/DevicesList.js2
2 files changed, 4 insertions, 5 deletions
diff --git a/modern/src/CommandsPage.js b/modern/src/CommandsPage.js
index 1458b43..3680a0d 100644
--- a/modern/src/CommandsPage.js
+++ b/modern/src/CommandsPage.js
@@ -66,13 +66,12 @@ const CommandsPage = () => {
}, [id]);
const handleSend = async () => {
+ const cmd = commands.find(c => c.id.toString() == selectedCommand);
+ cmd.deviceId = device.id;
const response = await fetch(`/api/commands/send`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({
- 'id': selectedCommand,
- 'deviceId': device.id,
- }),
+ body: JSON.stringify(cmd),
});
if (response.ok) {
diff --git a/modern/src/DevicesList.js b/modern/src/DevicesList.js
index 967ca82..1bc1fa7 100644
--- a/modern/src/DevicesList.js
+++ b/modern/src/DevicesList.js
@@ -96,7 +96,7 @@ const DeviceRow = ({ data, index, style }) => {
const showIgnition = position?.attributes.hasOwnProperty('ignition') && position.attributes.ignition === true;
const statusColor = () => {
- if (position && position.speed >= 2) {
+ if (item.status == "online") {
return 'primary';
} else {
return 'error';