22 lines
803 B
JavaScript
22 lines
803 B
JavaScript
async function fetchJson(path) {
|
|
const res = await fetch(path);
|
|
if (!res.ok) throw new Error(path + " HTTP " + res.status);
|
|
return res.json();
|
|
}
|
|
|
|
export async function fetchDashboardData() {
|
|
const [overview, system, services, storage, adguard, scrutiny, immich, backrest, home_assistant, uptime_kuma] =
|
|
await Promise.all([
|
|
fetchJson("/api/overview"),
|
|
fetchJson("/api/system"),
|
|
fetchJson("/api/services"),
|
|
fetchJson("/api/storage"),
|
|
fetchJson("/api/adguard"),
|
|
fetchJson("/api/scrutiny"),
|
|
fetchJson("/api/immich"),
|
|
fetchJson("/api/backrest"),
|
|
fetchJson("/api/home_assistant"),
|
|
fetchJson("/api/uptime_kuma"),
|
|
]);
|
|
return { overview, system, services, storage, adguard, scrutiny, immich, backrest, home_assistant, uptime_kuma };
|
|
} |