feat(dashboard): add AdGuard + Scrutiny frontend integration
This commit is contained in:
@@ -1,27 +1,19 @@
|
||||
const DEFAULT_HEADERS = {
|
||||
Accept: "application/json",
|
||||
};
|
||||
const BASE_URL = "";
|
||||
|
||||
async function fetchJson(path) {
|
||||
const response = await fetch(path, {
|
||||
headers: DEFAULT_HEADERS,
|
||||
cache: "no-store",
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Request failed for ${path}: ${response.status}`);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
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] = await Promise.all([
|
||||
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 };
|
||||
return { overview, system, services, storage, adguard, scrutiny };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user