refactor: SystemSettings-Dispatch aus _app entfernt und in Seite 'Einstellungen' verlagert
This commit is contained in:
@@ -1,9 +1,52 @@
|
||||
import React, { useState } from "react";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { useAppDispatch } from "../redux/store";
|
||||
import { setSystemSettings } from "../redux/slices/systemSettingsSlice";
|
||||
import { loadWindowVariables } from "../utils/loadWindowVariables";
|
||||
import GeneralSettings from "../components/main/settingsPageComponents/GeneralSettings";
|
||||
import OPCUAInterfaceSettings from "../components/main/settingsPageComponents/OPCUAInterfaceSettings";
|
||||
|
||||
export default function Settings() {
|
||||
const [activeTab, setActiveTab] = useState("tab1");
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
useEffect(() => {
|
||||
const loadSettings = async () => {
|
||||
const vars = await loadWindowVariables();
|
||||
if (!vars) return;
|
||||
|
||||
const {
|
||||
deviceName,
|
||||
mac1,
|
||||
ip,
|
||||
subnet,
|
||||
gateway,
|
||||
cplInternalTimestamp,
|
||||
ntp1,
|
||||
ntp2,
|
||||
ntp3,
|
||||
ntpTimezone,
|
||||
ntpActive,
|
||||
} = vars;
|
||||
|
||||
dispatch(
|
||||
setSystemSettings({
|
||||
deviceName,
|
||||
mac1,
|
||||
ip,
|
||||
subnet,
|
||||
gateway,
|
||||
cplInternalTimestamp,
|
||||
ntp1,
|
||||
ntp2,
|
||||
ntp3,
|
||||
ntpTimezone,
|
||||
ntpActive,
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
loadSettings();
|
||||
}, [dispatch]);
|
||||
|
||||
return (
|
||||
<div className="p-4">
|
||||
|
||||
Reference in New Issue
Block a user