aboutsummaryrefslogtreecommitdiff
path: root/modern/src/admin
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-06 14:23:44 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-06 14:23:44 -0700
commita0406374030e930b8bd8032900e83b4a432ae28a (patch)
tree7ac2a8c1ac60289477a482fd57e669362affdc7b /modern/src/admin
parent3812292cc4413efff1358eb34cc5bccab9d1cbae (diff)
downloadtrackermap-web-a0406374030e930b8bd8032900e83b4a432ae28a.tar.gz
trackermap-web-a0406374030e930b8bd8032900e83b4a432ae28a.tar.bz2
trackermap-web-a0406374030e930b8bd8032900e83b4a432ae28a.zip
Fix account and server updates
Diffstat (limited to 'modern/src/admin')
-rw-r--r--modern/src/admin/ServerPage.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/modern/src/admin/ServerPage.js b/modern/src/admin/ServerPage.js
index 5e608dee..33f8eeee 100644
--- a/modern/src/admin/ServerPage.js
+++ b/modern/src/admin/ServerPage.js
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { useState } from 'react';
import TextField from '@material-ui/core/TextField';
import {
@@ -39,8 +39,8 @@ const ServerPage = () => {
const userAttributes = useUserAttributes(t);
const deviceAttributes = useDeviceAttributes(t);
- const item = useSelector((state) => state.session.server);
- const setItem = (updatedItem) => dispatch(sessionActions.updateServer(updatedItem));
+ const original = useSelector((state) => state.session.server);
+ const [item, setItem] = useState({ ...original });
const handleSave = async () => {
const response = await fetch('/api/server', {
@@ -50,6 +50,7 @@ const ServerPage = () => {
});
if (response.ok) {
+ dispatch(sessionActions.updateServer(await response.json()));
history.goBack();
}
};