Build application shell with live runtime status

This commit is contained in:
litoral05
2026-05-20 12:22:40 +01:00
parent b38c374a81
commit 9fcf67c7ae
16 changed files with 672 additions and 6 deletions
@@ -0,0 +1,33 @@
import { useEffect, useState } from "react";
import { fetchRuntimeConfig } from "../../../lib/api/systemApi";
import type { RuntimeConfig } from "../../../types/system";
export function useRuntimeConfig() {
const [runtimeConfig, setRuntimeConfig] = useState<RuntimeConfig | null>(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
fetchRuntimeConfig()
.then((data) => {
setRuntimeConfig(data);
setError(null);
})
.catch((exception: unknown) => {
setError(
exception instanceof Error
? exception.message
: "Failed to fetch runtime config.",
);
})
.finally(() => {
setLoading(false);
});
}, []);
return {
runtimeConfig,
loading,
error,
};
}