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