20 lines
591 B
JavaScript
20 lines
591 B
JavaScript
const BASE_URL = "";
|
|
|
|
async function fetchJson(path) {
|
|
const res = await fetch(`${BASE_URL}${path}`);
|
|
if (!res.ok) throw new Error(`HTTP ${res.status} for ${path}`);
|
|
return res.json();
|
|
}
|
|
|
|
export async function fetchDashboardData() {
|
|
const [overview, system, services, storage, adguard, scrutiny] = await Promise.all([
|
|
fetchJson("/api/overview"),
|
|
fetchJson("/api/system"),
|
|
fetchJson("/api/services"),
|
|
fetchJson("/api/storage"),
|
|
fetchJson("/api/adguard"),
|
|
fetchJson("/api/scrutiny"),
|
|
]);
|
|
return { overview, system, services, storage, adguard, scrutiny };
|
|
}
|