git commit -m "refactor: last20Messages aus _app.tsx entfernt und über Thunk in dashboard.tsx geladen"
This commit is contained in:
@@ -9,8 +9,21 @@ import Last20MessagesTable from "../components/main/uebersicht/Last20MessagesTab
|
||||
import NetworkInfo from "../components/main/uebersicht/NetworkInfo";
|
||||
import VersionInfo from "../components/main/uebersicht/VersionInfo";
|
||||
import Baugruppentraeger from "../components/main/uebersicht/Baugruppentraeger";
|
||||
import { fetchLast20MessagesThunk } from "../redux/thunks/fetchLast20MessagesThunk";
|
||||
import { useAppDispatch } from "../redux/store";
|
||||
|
||||
const Dashboard: React.FC = () => {
|
||||
//-------------------------------------
|
||||
const dispatch = useAppDispatch();
|
||||
useEffect(() => {
|
||||
dispatch(fetchLast20MessagesThunk());
|
||||
const interval = setInterval(() => {
|
||||
dispatch(fetchLast20MessagesThunk());
|
||||
}, 10000); // oder 5000
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}, [dispatch]);
|
||||
//-------------------------------------
|
||||
return (
|
||||
<div className="flex flex-col gap-3 p-4 h-[calc(100vh-13vh-8vh)] laptop:h-[calc(100vh-10vh-5vh)] xl:h-[calc(100vh-10vh-6vh)] laptop:gap-0">
|
||||
{/* Header */}
|
||||
|
||||
Reference in New Issue
Block a user