Files
archivmail/src/hooks/useSystemInfo.ts
T
sysops a55faf74b1 chore: Frontend-Seiten in Komponenten/Hooks aufteilen
admin/page.tsx (1019→446), search/page.tsx (871→304), imap/page.tsx
(738→142), settings/page.tsx (641→56). Reine Umstrukturierung,
keine Verhaltensänderung, Build verifiziert.
2026-06-22 11:29:43 +02:00

30 lines
742 B
TypeScript

"use client";
import { useEffect, useState } from "react";
import { getSystemInfo, type SystemInfo } from "@/lib/api";
export function useSystemInfo() {
const [systemInfo, setSystemInfo] = useState<SystemInfo | null>(null);
const [systemInfoLoading, setSystemInfoLoading] = useState(true);
useEffect(() => {
let cancelled = false;
setSystemInfoLoading(true);
getSystemInfo()
.then((info) => {
if (!cancelled) setSystemInfo(info);
})
.catch(() => {
if (!cancelled) setSystemInfo(null);
})
.finally(() => {
if (!cancelled) setSystemInfoLoading(false);
});
return () => {
cancelled = true;
};
}, []);
return { systemInfo, systemInfoLoading };
}