From 9b31494d9c7690ab84983f8e93e4fc38fc5ccd6e Mon Sep 17 00:00:00 2001 From: Alexander Borg Date: Thu, 28 Aug 2025 08:18:11 +0200 Subject: [PATCH] Fix jwt-token --- client/src/pages/Devices.jsx | 42 ++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/client/src/pages/Devices.jsx b/client/src/pages/Devices.jsx index d8c542c..9666813 100644 --- a/client/src/pages/Devices.jsx +++ b/client/src/pages/Devices.jsx @@ -545,15 +545,21 @@ const DeviceModal = ({ device, onClose, onSave }) => { try { if (device) { - // Update existing device - await api.put(`/devices/${device.id}`, formData); + // Update existing device - exclude read-only fields + const updateData = { + name: formData.name, + location_description: formData.location_description, + notes: formData.notes + }; + await api.put(`/devices/${device.id}`, updateData); } else { - // Create new device + // Create new device - include all fields await api.post('/devices', formData); } onSave(); } catch (error) { console.error('Error saving device:', error); + alert('Error saving device: ' + (error.response?.data?.message || error.message)); } finally { setSaving(false); } @@ -614,28 +620,40 @@ const DeviceModal = ({ device, onClose, onSave }) => {
@@ -655,16 +673,22 @@ const DeviceModal = ({ device, onClose, onSave }) => {