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.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
"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 };
|
||||
}
|
||||
Reference in New Issue
Block a user